After upgrading to 2008 Q2 my application crashes in several grid event handlers.
For example the CellFormatting event is now also fired for the Filter Row and when the event handler wants to get the data for the cell, it's obviously Null when the grid loads and no filter is set.
If there are there are other breaking changes to the Grid, please update the documentation.
Worked Pre Q2:
Now have to add an additional test (plus additional test of NULL returned by the DB which is not currently possible by the Data Definition).
regards
Erwin
For example the CellFormatting event is now also fired for the Filter Row and when the event handler wants to get the data for the cell, it's obviously Null when the grid loads and no filter is set.
If there are there are other breaking changes to the Grid, please update the documentation.
Worked Pre Q2:
void _grid_CellFormatting(object sender, CellFormattingEventArgs e) |
{ |
if (e.CellElement.ColumnInfo is GridViewDataColumn && !(e.CellElement.RowElement is GridTableHeaderRowElement)) |
{ |
GridViewDataColumn column = (GridViewDataColumn)e.CellElement.ColumnInfo; |
if (column.FieldName == "Minutes") |
{ |
int minutes = (int)e.CellElement.RowInfo.Cells["Minutes"].Value; |
TimeSpan ts = TimeSpan.FromMinutes(minutes); |
e.CellElement.Text = string.Format("{0:00}:{1:00}", ts.Hours, ts.Minutes); |
Now have to add an additional test (plus additional test of NULL returned by the DB which is not currently possible by the Data Definition).
void _grid_CellFormatting(object sender, CellFormattingEventArgs e) |
{ |
if (e.CellElement.ColumnInfo is GridViewDataColumn && (!(e.CellElement.RowInfo is GridViewFilteringRowInfo)) && |
(!(e.CellElement.RowElement is GridTableHeaderRowElement))) |
{ |
GridViewDataColumn column = (GridViewDataColumn)e.CellElement.ColumnInfo; |
if (column.FieldName == "Minutes") |
{ |
if(e.CellElement.RowInfo.Cells["Minutes"].Value!=null) |
{ |
int minutes = (int)e.CellElement.RowInfo.Cells["Minutes"].Value; |
TimeSpan ts = TimeSpan.FromMinutes(minutes); |
regards
Erwin