I have an xtragrid that I populate and has 2 unbound columns. Everything works fine except when i go to filter the columns, the popup of filtering displays correctly but when i double click on a value i get a nullreference exception. I managed to find where the exception is and it is in my method CustomColumnUnboundData where i try to get the current object from the current row and the object is null. Can you help me? What am I doing wrong ? e.ListSourceRowIndex or GetRow() does not seem to work on filtering...
private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
{
GridView gridView = (GridView)sender;
int dataSourceIndex = e.ListSourceRowIndex;
Person person = (Person)gridView.GetRow(dataSourceIndex);
if (e.Column.FieldName == "name" && e.IsGetData)
{
e.Value = person.PersonKey.Name;
}
if (e.Column.FieldName == "surname" && e.IsGetData)
{
e.Value = person.PersonKey.Surname;
}
}
Solved.
private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
{
GridView gridView = (GridView)sender;
Person person = e.Row as Person;
//...
}