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.

Parsing and Formatting Cell Values

Thread ID:





53512 Dec 14,2006 10:08 AM Dec 15,2006 08:12 AM Windows Forms 4
Tags: GridControl
Asked On December 14, 2006 10:08 AM


I'd like to know if there is a way to format/parse a cell value of a GridDataBoundGrid?

my Grid is databounded to a BindingSource.

For example, if I had a textbox i would do so
this.tbxLastModifDate.DataBindings["Text"].Format += new ConvertEventHandler(tbxLastModifDate_Format);
this.tbxLastModifDate.DataBindings["Text"].Parse += new ConvertEventHandler(tbxLastModifDate_Parse);

But How can I make it with Syncfusion grid?


Administrator [Syncfusion]
Replied On December 14, 2006 11:48 PM

Hi Barzot ,

You can set StyleInfo.Format property for formatting the cell values. You can specify the numeric foramt string, Date format string or enumeration format string. Please refer to the attached browser sample for more details.

this.gridDataBoundGrid1.Binder.InternalColumns[1].StyleInfo.Format = "C05";

Sample: GDBGCellFormat.zip

Also refer our shipped TextFormat browser sample for more details.
[install path:]\Syncfusion\Essential Studio\\windows\Grid.Windows\Samples\Quick Start\TextFormat\

Best Regards,

Replied On December 15, 2006 03:56 AM


Thx for your answer, but in my case, it's not just that, with the value I get from the database, I have to apply a method to calculate a readable data for the user, and then parse the value from the user to the database.

In Attachment, you'll find a projet in C# 2005 with a little example of what i mean.

Thx a lot,


Administrator [Syncfusion]
Replied On December 15, 2006 05:32 AM

Hi Barzot,

This can be achieved by handling the Model.QueryCellFormattedText event and set e.Handled = true to handle it. Here is a code snippet to show this.

//For display the formatted text.
void Model_QueryCellFormattedText(object sender, Syncfusion.Windows.Forms.Grid.GridCellTextEventArgs e)
if (e.Style.CellIdentity.ColIndex == 4 && e.Value != null)
Double result;
if (Double.TryParse(e.Value.ToString(), out result))
e.Text = clsDateConversion.CacheToDotNet(result).ToString();
///must set e.Handled = true to handle it
e.Handled = true;

Please refer to the modified sample for more details.

Best Regards,

Replied On December 15, 2006 08:12 AM

Hi Haneef,

I just want to thank you for your help and support by Syncfusion, great work guys.

Keep Doin' such good work.



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.