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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Parsing and Formatting Cell Values

Thread ID:

Created:

Updated:

Platform:

Replies:

53512 Dec 14,2006 03:08 PM UTC Dec 15,2006 01:12 PM UTC WinForms 4
loading
Tags: GridControl
Barzot
Asked On December 14, 2006 03:08 PM UTC

Hi,

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?

Thx

Administrator [Syncfusion]
Replied On December 15, 2006 04:48 AM UTC

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\4.3.0.25\windows\Grid.Windows\Samples\Quick Start\TextFormat\

Best Regards,
Haneef

Barzot
Replied On December 15, 2006 08:56 AM UTC

Hi,

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,
Barzot

SyncFusion.Grid.AppTest.zip

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

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.
SyncFusion.Grid.AppTest.zip

Best Regards,
Haneef

Barzot
Replied On December 15, 2006 01:12 PM UTC

Hi Haneef,

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

Keep Doin' such good work.

Bye

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

;