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. Image for the cookie policy date
close icon

Format Data in GridDataBoundGrid

I tried to format data in GridDataBoundGrid by GridDataBoundGrid1[i, j].Format="0.000" or GridDataBoundGrid1[i, j].Format="{0:0.000}" It did not work. Is there a different way (there must be) to format numerical data? Thank you very much for help. J. Sun

1 Reply

AD Administrator Syncfusion Team June 24, 2005 04:12 PM UTC

You cannot set cell specific properties in a GridDataBoundGrid. See this KB. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=83 To set a format on a singler cell is a GridDataBoundGrid, you shuld handle the grid.Model.QueryCellInfo event. In your handler if e.RowIndex and e.ColIndex point to teh cell, set e.Style.Format = "0.00" (for example) and also set e.Style.CellValueType = typeof(double). In order for the formatting to work, the CellValueType property needs to be set. Now if you want to set a format on a column, then you can use teh GridBoundColumn.StyleInfo.Format / CellValueType properties to manage this without handling an event. But if you want to do it cell by cell, you need to handle grid.Model.QueryCellInfo.

Loader.
Live Chat Icon For mobile
Up arrow icon