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

Grid showing formatted value in edit mode

Thread ID:

Created:

Updated:

Platform:

Replies:

26018 Mar 11,2005 03:43 PM UTC Mar 11,2005 08:45 PM UTC Windows Forms 1
loading
Tags: Grouping
Faraz Haque
Asked On March 11, 2005 03:43 PM UTC

Hi, I am sure this is a common one. I am using an editable grouping grid on one of my forms. For display purpose, I need to show numeric columns to 0 decimal places. But when the user clicks on the cell for editing, i need to show 2 decimal places. I cant seem to find a straightforward way to do it! Any help would be great -faraz

Administrator [Syncfusion]
Replied On March 11, 2005 08:45 PM UTC

One way I think you can do this is to handle the TableControlCurrentCellInitializeControlText, and there format the string that is used to initizize the control text. Here is a little snippet. You would have to ID the cell somehow where you want this formatting to happen. Here the code just formats all doubles.
private void gridGroupingControl1_TableControlCurrentCellInitializeControlText(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellInitializeControlTextEventArgs e)
{
	if(e.Inner.CellValue is double)
	{
		e.Inner.ControlText = string.Format("{0:F2}", e.Inner.CellValue);
	}
}

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

;