How can I allow the entering of only numbers in ultrawingridcell in edit mode
I do not agree with you. Yes 'nnnn' will prevent entering characters others than numeric but it will also entering more than 4 characters which is not perfectly aligned with the original question where he asked how to prevent entering other than numerics characters. But the keypress is in my view a good option because the integer style will also behaves like a mask which I think is not a good UX choice.
I believe that tells the grid to use an EditorWithMask with a numeric mask, which is pretty much what I suggested. Try typing letters in the cell; if disallows non-numeric characters, you'll know it works.
Thanks Brian.
How about using this below code?
private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { if (e.Row.Index == 2) e.Row.Cells["My Column"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Integer; }
Two possible approaches come to mind:
1. Set the UltraGridColumn.MaskInput property to a numeric-only mask, for example, 'nnnn' or 'nn.nn'.
2. Handle the control's KeyPress event and set the Handled property of the event args to true if the incoming character is non-numeric.