Format for null values

Is there a way to define a string to be displayed for null values in a cell?

I want to display a - sign when null values appear in any cell, regardless of the column type.

1 Reply

HA haneefm Syncfusion Team July 24, 2007 02:55 PM UTC

Hi Lucia,

You can do this dynamically in DrawCellDisplayText. This way you do not modify the actual datatable values, but instead just change what the grid displays.

private void gridDataBoundGrid1_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
if(e.Style.CellIdentity.ColIndex == 1)
{
if(e.Style.CellValue == null && e.DisplayText == String.Empty)
{
e.DisplayText = "-";
e.Cancel = true;
}
}
}

Best regards,
Haneef

Loader.
Up arrow icon