I have a datagrid that contains data from different documents. The user can edit some of the columns. I want to restrict them to only be able to enter a number. I would like to do it from the client side instead of server side as that would mean checking 20 or more documents.
ok figured out what to do. Create a function to format the data with as red background if they enter a non-numeric or invalid value. Put the function in a scriptBlock and put the name in the formatter field for each column
function ValidNmbr(s)
{
var RegularExpression = new RegExp(/^\$?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/);<br/>
if(RegularExpression.test(s))
{
return s;
}
else {
return "<span style='background-color:red'>"+s+"</span>";
}
}