Completed
Last Updated: 17 Nov 2015 16:27 by Svetlin
Svetlin
Created on: 11 Dec 2012 08:06
Category: GridView
Type: Bug Report
1
FIX. RadGridView - the CurrentRowChanged event is not fired when empty collection is bound to RadGridView.
Workaround the issue by using the DataBindingComplete event in the following manner:

private GridViewRowInfo oldCurrentRow = null;

protected override void OnLoad(EventArgs e)
{
this.radGridView1.DataBindingComplete += this.OnDataBindingComplete;

this.oldCurrentRow = this.radGridView1.CurrentRow;
this.radGridView1.DataSource = Telerik.Help.Data.GetDummyEmployees(0);
}

private void OnDataBindingComplete(object sender, Telerik.WinControls.UI.GridViewBindingCompleteEventArgs e)
{
    if (this.oldCurrentRow != this.radGridView1.CurrentRow && this.radGridView1.RowCount == 0)
    {
        this.radGridView1.MasterTemplate.EventDispatcher.RaiseEvent<CurrentRowChangedEventArgs>(EventDispatcher.CurrentRowChanged,
            this.radGridView1.MasterTemplate, new CurrentRowChangedEventArgs(null, null));
    }
 
    this.oldCurrentRow = null;
}
0 comments