We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Format for null values

Thread ID:

Created:

Updated:

Platform:

Replies:

64863 Jul 24,2007 08:27 AM Jul 24,2007 10:55 AM Windows Forms 1
loading
Tags: GridControl
Lucia Diaconu
Asked On July 24, 2007 08:27 AM

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.

haneefm [Syncfusion]
Replied On July 24, 2007 10:55 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;