I am trying to conditionally enable and disable a CellElement based on the previous cells value. The code below works fine if the number of rows visible on the GridView appear all on one screen. If the rows exceed one screen and are scrollable, I get a null reference exception on "rowInfo.Cells[7].CellElement.Enabled = false;". Any ideas why it might be happening or a perhaps a better way to do this would really be helpful.
foreach ( var rowInfo in radGridView1.MasterGridViewTemplate.Rows ) |
{ |
if ( ( !( (bool)rowInfo.Cells[6].Value ) ) ) continue; |
rowInfo.Cells[7].CellElement.Enabled = false; |
} |
radGridView1.Columns[6].IsVisible = false; |