The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator 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.