Completed
Last Updated: 20 Jan 2015 15:43 by ADMIN
ADMIN
Dimitar
Created on: 08 Jan 2015 17:18
Category: GridView
Type: Bug Report
0
FIX. RadGridView - when the search functionality is used with combination of filtering NullReferenceException is thrown.
To reproduce:
- Enable the search row in the 50000 rows example.
- Set the 5 last rows RowIndex value to null.
- Set the filter of the RowIndex column to "Is null" and then to "Is not null"
- Type 499 in the search row.
- Set the filter of the RowIndex column to "Is null" and then to "Is not null" again.

Workaround:
public class MyGridViewSearchRowInfo : GridViewSearchRowInfo
{
    public MyGridViewSearchRowInfo(GridViewInfo viewInfo) : base(viewInfo)
    {
    }

    protected override int GetCurrentCellTraverserColumnIndex()
    {
        if (this.ViewTemplate.MasterTemplate.Owner.CurrentRow == null)
        {
            return -1;
        }
        
        return base.GetCurrentCellTraverserColumnIndex();
    }
}
//change the row like this:
void radGridViewDemo_CreateRowInfo(object sender, GridViewCreateRowInfoEventArgs e)
{
    if (e.RowInfo is GridViewSearchRowInfo)
    {
        e.RowInfo = new MyGridViewSearchRowInfo(e.ViewInfo);
    }
}
0 comments