I have a column that has values that can be different formats;
1 / 1.0 / $1.00 / 7.65%
The grid is for displaying the data, no editing.
How can i format the text values to what I want? I dont seem to be able to figure out the correct formating string.
Heres what I have atm, works on the whole column :), not the cell itself.
uwGrid_RptResult_Prt1_InitializeRow
If (e.Row.Cells("Category").Text.IndexOf("Percentage") > -1) Then
e.Row.Appearance.BackColor = System.Drawing.Color.FromName("Lime") ' just so I can see I am in area I should be.
e.Row.Cells("Category: Result").Column.Format = "#0.##%" ' ok this does somethign but not sure what! the cell should be displaying 7.65% but i get 700%!
End If
Any help would be most appreciated on this.
Thanks
Deasun
This is what I came up with:
for the % cells:
e.Row.Cells("Category: Result").Value = String.Format(System.String.Format("{0:F2}", e.Row.Cells("Category: Result").Value))
For the decimal cells:
Dim intValueIs As Integer = Convert.ToDecimal(e.Row.Cells("Category: Result").Value)
e.Row.Cells("Category: Result").Value = intValueIs
Hello,
It seems to me that you are trying to format each cell in the column with a different string, is that right? I believe that the format from your first post is not working because of the percent(%) sign. Do these formats in your last post work fine for you?