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

Setting the Format for a columns in a DataBoundGrid

I am trying to format a column of data in a grid. If I do not try to set the format of the column the data shows in the grid. Using the debugger I have checked the InternalColumns collection and there are no columns defined. What else do I need to check? ================================================== aGrid.DataSource = fact.DefaultView; // works OK GridStyleInfo style = aGrid.Binder.InternalColumns["TotalProbability"].StyleInfo; // Fails see below style.CellValueType = typeof(System.Double); style.Format = "P"; ================================================== Error Message. Object reference not set to an instance of an object.

3 Replies

AD Administrator Syncfusion Team October 22, 2004 01:44 PM UTC

The grid.Binder.InternalColumns are only used if you have not explicitly added GridBoundColumns to the grid.GridBoundColumns collection. If you have added such GridBoundCOlumns, then then you woul duse that collection to get the GridBoundColumn.StyleInfo. The other thing to check is that the column name is exactly correct, including case. Here is a little sample showing things working. If you cannot spot the problem, can you post a little sample showing it. GridBoundColumns_1086.zip


RD Rick Davis October 22, 2004 01:58 PM UTC

I have not explicted added the columns, but on the form I have a total of 6 different girds on different tabs. I have been able to duplicate the problem by creating a new form with a tab control with 6 tabs and a grid on each tab. When I try format the column on the any of the grids I get the same error. >The grid.Binder.InternalColumns are only used if you have not explicitly added GridBoundColumns to the grid.GridBoundColumns collection. If you have added such GridBoundCOlumns, then then you woul duse that collection to get the GridBoundColumn.StyleInfo. > >The other thing to check is that the column name is exactly correct, including case. > >Here is a little sample showing things working. If you cannot spot the problem, can you post a little sample showing it. > >GridBoundColumns_1086.zip > >


AD Administrator Syncfusion Team October 22, 2004 07:22 PM UTC

You did not include your sample. Here is a sample showing a tabcontrol and 6 grids without a problem. I am using 2.1.0.9. What version are you using? Can you post your sample? GridBoundColumns_8343.zip

Loader.
Live Chat Icon For mobile
Up arrow icon