Do we have any inbuilt function to check if the key entered in XamWebGrid are numeric?
How can I use the key_down event of xxamwebgrid to accomplish this.
The columns used in the Grid are template columns ..I cannot use textcolumn.Formatstring function.
The Char struct has a static method which will return true if a given char is a numeric character
Char.IsNumeric()
http://msdn.microsoft.com/en-us/library/system.char.isnumber.aspx
Thanks.
But we do not have an option to cancel if we do not want to acept the character in keydown event.
Any other possibilities?
If you are trying to limit what data can be entered you should probably be using a TemplateColumn and using the NumericEditor as the EditorTemplate
Something like this:
<ig:TemplateColumn Key="Int"> <ig:TemplateColumn.EditorTemplate > <DataTemplate> <editors:XamWebNumericEditor ValidationMode="Always" ValueType="System:Int32" Value="{Binding Int, Mode=TwoWay}" > </editors:XamWebNumericEditor> </DataTemplate> </ig:TemplateColumn.EditorTemplate> <ig:TemplateColumn.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Int}" /> </DataTemplate> </ig:TemplateColumn.ItemTemplate> </ig:TemplateColumn>