I am using a amount column in Webgrid.
I want to put a validation to the column so that it accepts only integer values.
Also i want to display proper message to user when he enters invalid data ex- alphabets,spl chars etc.
How can i achieve this ?
Hi,
grid_BeforeExitEditModeHandler(gridName, cellId, newValue)
{
if (newValue is Interger value)
return 0; //Valid
else
return 1; //Invalid
}
Hope this helpfull.
Thanks a lot for the solution.
But i am facing 2 new problems now.
1) how to check the newValue is integer or not at client side?
2) this validation gets applied to all coulmns. i want it only for the Amount column i.e the 3rd column on the grid.
in the exit mode check which is source element from event. if its not 3rd column the return.
for checking value you can do this.
try{
int.parse(value);
catch (e) { show your msg; }