Hi,
While running this code, get null exception some times,
{
ugr.Cells["Select"].Value = true;
else
}
Can anyone suggest any other method to set the column value.
regards,
pgr2007
pgr2007 said:Is there anything I have to take care before changing.
Nope. Can't think of anything.
HI,
Thanks for the reply,
It worked, really appreciate your commitment.
this.UltraGrid1.Rows.GetAllNonGroupByRows() instead of this.UltraGrid1.Rows
Is there anything I have to take care before changing.
Okay, that makes sense. When you group the grid using OutlookGroupB, the root level rows of the grid are no longer data rows, they are groupby rows and (as you can see) they don't have any cells.
What you probably want to do is is use grid.Rows.GetFilteredInNonGroupByRows or GetAllNonGroupByRows, instead of just grid.Rows.
Thanks for the reply.
This code will be executed when a row is selected and at that time I will makes the column "Select" to true (this column is hidden in Grid).
The null exception occur due to ugr.Cells is null and this is not always null.
The sequence it comes null
1. when the columns are grouped like in outlook ( this.UltraGrid1.DisplayLayout.Bands[0].SortedColumns.Count>0 ) and selects a row. 2. if the user first clicks the header (column header) of the grid and then selects a row.
1. when the columns are grouped like in outlook ( this.UltraGrid1.DisplayLayout.Bands[0].SortedColumns.Count>0 ) and selects a row.
2. if the user first clicks the header (column header) of the grid and then selects a row.
I'm afraid it's hard to offer you any advice with so little to go on. What exactly are you trying to accomplish? When is this code called? What is null when you get the exception? Which line of code is the exception occurring on?