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.

handling zeros in GCC

Thread ID:





59659 Apr 19,2007 09:04 AM Apr 19,2007 12:02 PM Windows Forms 1
Tags: GridControl
dinesh upreti
Asked On April 19, 2007 09:04 AM


I am using GCC bound to a custom entity collction.

I am having following two problems.

1) If the entity is having 0 as value for a property of type integer OR double, that column should be shown as a blanked in Grid. by default it displays the value held by property i.e 0.

2)There is another integer property which has say value 1234 and in another instance say 56789. When i want to show them in grid,I want to mask the values so that zeros should be appended to the begining of number so that total number of visible digits are eight. so in my example when i display the values in grid, they should be shown as 00001234 and 00056789 respectively.

Please help me with a solution for above



haneefm [Syncfusion]
Replied On April 19, 2007 12:02 PM

Hi Dinesh,

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 TableModel_QueryCellFormattedText(object sender, GridCellTextEventArgs e)
GridTableCellStyleInfo style = e.Style as GridTableCellStyleInfo;
Element el = style.TableCellIdentity.DisplayElement;
if( el.Kind == DisplayElementKind.Record
&& style.TableCellIdentity.Column != null
&& style.TableCellIdentity.Column.Name == "ID" )
if( e.Style.Text == "0" )
e.Text = "Welcome";
e.Text = string.Format("{0:000000.##}",e.Style.CellValue);
e.Handled = true;

Best regards,


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.