Hi
I have tried to search for this and have seen some results but with an editable column. I have a grid that has a dataset as it's data source and a decimal column that we current set the format for in the display layout in the bands columns.
I would like to know if you can set the format for a column on a row by row basis because the bands is for all the columns in the data source. Now the rows are read only so it's not like I need to edit the column.
The sample code is below but again it applies to all the columns.
For Each ocolumn As Infragistics.Win.UltraWinGrid.UltraGridColumn In grdAccounts.DisplayLayout.Bands(0).Columns
With ocolumn
Select Case .Key
Case "Current Balance"
If bShowBalances = True Then
.Format = "$#,###,##0.00"
Else
.Format = "$************"
End If
End Select
End Width
Next
The reason I have the call to the Format is because we have that grid on multiple panels with the same information and we didn't want to duplicate the calls to initialize or format the grid. I was looking into having some of those panels potentially have some of the row columns masked and some not but not on all the grids. If I change the format to not be done on the band then that forces me to set it for each row in all the panels when I was only modifying some of the panels if I'm making sense.
Hi Rene,
I tried your sample and I get the same results. That's very odd. I would think the cell editor setting would take precedence over the column. But that's not always the case. And the solution in this case is very simple - don't set the Format on the Column. You are setting it on each row, anyway, so there's no need.
Thanks for the sample and response. I did see that sample in a previous post so I tried it with setting a format of "$*******" after 2 decimal points and that worked.
However in my production code. I load a dataset, set the grid's data source to said dataset, iterate through the bands and set the format for the column there and then I appeared to hit the row initialize and the format on the band seemed to take precedence over the format I was setting with an editor at the row initialize error.
I'm enclosing a sample application on how we work with the grid. If I comment out the setting of the format on the band's column then the code in the row initialize works.
Thanks again!
I have attached a sample project here which demonstrates how to use embeddable editors to provide a different format for each row and by utilizing the cells 'Editor' property.
Let me know if you have any additional questions.