I would like to custom format for one cell in the grid. The grid has a column with double data type.
I formated this column:
ugrd.DisplayLayout.Bands[0].Columns["columnName"].Format = "#,###,##0.00";
But in the cell of the first row of this column, I would like to change the format to percent.
How can I do that.
You could create a new EditorControl to use on any cell that you want to have a different format than the rest of the column:
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e){ if (e.Row.Index == 0) { UltraGridCell cell = e.Row.Cells[2]; if (cell.EditorControl == null) { UltraNumericEditor editor = new UltraNumericEditor(); editor.FormatString = "p"; cell.EditorControl = editor; } }}
Of course, if you want to do this on more than one cell, it's recommended that you only create this editor once on the form and reuse it for each cell as necessary.
-Matt
I did like this but the result is not as I expected. This cell still has format #,###.##0.000.
I am using NetAdvantage 2007 Vol 2.!
It seems to be that we can use the editor to edit cell, but can use editor for custom format on the cell.
Do you have any idea.
I've tried the same sugestion but I get the same result ... Nothing.
The cells keep the column format.
According to Mike Saltzman:
"The Format property only exists on the column, not the cell. So you can't do this with a property setting.
One way you could to this would be to use an unbound column. You could hide the real, bound column in the grid and add an unbound column. You would then use the InitializeRow event to examine the value in the bound column and populate the unbound column with whatever text you want in whatever format you want. "
http://community.infragistics.com/forums/p/4486/21544.aspx#21544