Dear all,
In the cells in the ultragrid, I want to set the number format, 99999.99
Is there any proper way to restrict the user input??
On the other hand I have set the max value of the cells in the designer view. But Don't know why when there are 3 decimal places, it is allowed??
Do you know why??
You can set the UltraGridColumn.MaskInput property to (for example) "nnnnn.nn". The Format property applies only to the display format for the cell, whereas the MaskInput property is used to enforce character input rules.
It does not work. I don't see masked input in the ultragrid column. Moreover, is there any other method??
Hello rchiu5hk,
I believe that you could still use the MaskInput property of the desired column like:
ultraGrid1.DisplayLayout.Bands[Key].Columns[Index].MaskInput = "nnnnn.nn";
or the same code but in the IntializeLayout event of the UltraGrid like:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Bands[Index].Columns[Key].MaskInput = "nnnnn.nn"; }
Please let me know if you have any other questions.
Can we set the decimal places of indiviual cell?
e.g. I have gird with a doble datatype column. Every row can have different number of decimals point. First row can have the column set as 23.46 whereas another row can have the same column set as 0.0001.
Can you tell me how this can be achieved. I tried looking mask input for ultragridcell but seems like the column (ultragridcolumn) has the property maskinput and not the cell.
I think this can be done, but it depends on exactly what you need to do. You are using the word "format" here, but formatting only applies to a cell that is NOT in edit mode. If the cell is editable by the user and you need different masks based on the row, then you would have to use an editor - like an UltraMaskEditor or UltraNumericEditor control and set the Editor/EditorComponent on the cell. You also need to set the UserEditorMaskSettings property on the column to tell the customer to use the msaking properties of the editor before the column's settings.
could you kind enough to post a sample code using the above editors for two different format in same column (i.e format for each cell in a column?)
I have attached a sample project which demonstrates applying a different format to each cell in a column.