Hi,
In one of the columns of the data bound grid i have to show $ sign in the cells which have some values.
If i made that column of the grid as Currency then in Null valued cells it is showing $0 which should be shown as blank.
Plz suggest...
AD
Administrator
Syncfusion Team
September 20, 2006 10:10 AM UTC
Hi Manpreet,
You can handle the DrawCellDisplayText event of the grid and set the e.DisplayText to some new value to want to display. Below is some code snippet.
private void DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
if(e.Style.CellType == "Currency" && e.DisplayText == "$0" )
{
e.DisplayText = string.Empty;
}
}
Thanks,
Haneef
MS
Manpreet Saini
September 20, 2006 11:35 AM UTC
Hi Haneef,
Thax for the reply but in that case if the cell has value 0, even then it will be displayed as Blank,that is not desired.
I want blank in case of Null only and the inserted value in all other cases(that value can be may be 0).
>Hi Manpreet,
You can handle the DrawCellDisplayText event of the grid and set the e.DisplayText to some new value to want to display. Below is some code snippet.
private void DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
if(e.Style.CellType == "Currency" && e.DisplayText == "$0" )
{
e.DisplayText = string.Empty;
}
}
Thanks,
Haneef
AD
Administrator
Syncfusion Team
September 20, 2006 12:00 PM UTC
Hi Manpreet,
Sorry for the inconvenience caused.
You can handle the QueryCellFormattedText event of the grid and set the e.Text to some formatted value to want to display. Below is some code snippet.
this.grid.Model.QueryCellFormattedText +=new GridCellTextEventHandler(QueryCellFormattedText);
private void Model_QueryCellFormattedText(object sender, GridCellTextEventArgs e)
{
if(e.Style.CellType == "Currency" && e.Value == null || e.Value.ToString().Trim() == string.Empty )
{
e.Text = string.Empty;
}
}
Thanks,
Haneef