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.

Formatting Double cellType

Thread ID:

Created:

Updated:

Platform:

Replies:

73187 Apr 24,2008 02:23 AM May 7,2008 09:35 PM Windows Forms 2
loading
Tags: GridControl
Jamilah Abdul Rashid
Asked On April 24, 2008 02:23 AM

Hi,

I'm creating an application that have a grid which user can change the cell format similar to Excel.

The only issue is, if a cell's CellValueType is set to Double, whenever user apply customize format (i.e "mm:ss"), the cell text will display the format text itself. This is undesirable.

i.e:
CellValueType = typeof(Double)
CellText = 101
Format = "mm:ss"

Displayed Text = mm:ss

In Excel, the cell value is converted to a DateTime value and then applies the format. Is there a way I can achieve this? or Is there a way I can block applying the format so that it won't display the format text itself?

Attached is the sample showing this issue.

Please help.

Thanks,
Jamilah Abdul Rashid




FormatCell.zip

Administrator [Syncfusion]
Replied On May 2, 2008 05:51 AM


Hi Jamilah,

Thanks for the interest in Syncfusion products.

You can set the format of the DateTime using the GridStyleInfo property. Please refer the following code snippet that shows how we can set the format of the DateTime value.


GridStyleInfo style = this.gridControl1.Model[2, 2];
style.CellValueType = typeof(DateTime);
style.Format = "mm:ss";
style.CellValue = DateTime.Now;


Please refer the sample in the below link that illustrates the above.

http://websamples.syncfusion.com/samples/Grid.Windows/F73187/main.htm

Please let me know if this helps.

Regards.
Asem.



Administrator [Syncfusion]
Replied On May 7, 2008 09:35 PM

Thanks Asem.
You gave an idea on fixing this.


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.

;