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.

Data Bound Grid Problem....

Thread ID:

Created:

Updated:

Platform:

Replies:

49494 Sep 20,2006 03:34 AM Sep 20,2006 08:00 AM Windows Forms 3
loading
Tags: GridControl
Manpreet Saini
Asked On September 20, 2006 03:34 AM

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...

Administrator [Syncfusion]
Replied On September 20, 2006 06:10 AM

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

Manpreet Saini
Replied On September 20, 2006 07:35 AM

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

Administrator [Syncfusion]
Replied On September 20, 2006 08:00 AM

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

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.

;