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

Formatting Double.Nan values

Thread ID:

Created:

Updated:

Platform:

Replies:

67696 Aug 28,2007 03:24 PM UTC Aug 29,2007 08:41 AM UTC Windows Forms 2
loading
Tags: Grouping
Paul Sullivan
Asked On August 28, 2007 03:24 PM UTC

Hi,
How do I format the contents of a cell containing double values if the double value is NaN? I want to display "" rather than "NaN" in this case. Is there an event I can intercept for this?

Ajish [Syncfusion]
Replied On August 28, 2007 10:22 PM UTC

Hi Paul,

If you want to display the formatted text in a cell then subscribe the QueryCellFormattedText event and set the e.Text to your new formatted value and then set e.Handled to TRUE to cancel default format. Here is a code snippet to show this,

private void gridControl1_QueryCellFormattedText(object sender, GridCellTextEventArgs e)
{

if (e.Style.CellValue != null)
{
double d;
double.TryParse(e.Style.CellValue.ToString(), out d);

if (double.Equals(d,double.NaN ) )
{
e.Text = "Haha!!!" + d;
e.Handled = true;
}
}
}
Kindly try the above and let me know if this helps in resolving this issue.

Regards,
Ajish.

Paul Sullivan
Replied On August 29, 2007 08:41 AM UTC

Thanks Ajish, that works well!

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.

Warning Icon 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.Close Icon

;