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

How to force format without defining columns

Hi, I use a databound grid. In my context, the number of columns to be displayed in the grid is unknown and variable. However all column should be formatted ###.dd except the first column who's format is 'd'. How can I force the format I describe without using the DataBoundGridColumns? I changed the base style but it seems to be overriden by the default format for my data's datatype (double) which displays a lot of decimals.

1 Reply

Administrator September 2, 2003 01:58 PM UTC

Try this.grid.TableStyle.Format = "###.00"; this.grid.TableStyle.CellValueType = typeof(double); Then all cells in the grid should use this format and cellvaluetype unless you explicitly set a GridBoundColumn.StyleInfo or handle events like PrepareViewStyleInfo or Model.QueryCellInfo to set particular styles.
Loader.
Live Chat Icon For mobile
Up arrow icon