You can use CustomValidator and JavaScript to do
the job, here is the solution:
1. Add a CustomValidator control.
2. Set ErrorMessage property of the CustomValidator
to "numerical values only!"
3. Set the ClientValidationFunction property to
IsNumber. IsNumber is a JavaScript function.
<script>
function IsNumber(source,arguments)
{
var input;
var ValidNumbers = "0123456789.";
var value=document.getElementById("SomeTextBox").value;
for (i = 0; i < value.length; i++)
{
input = value.charAt(i);
if (ValidNumbers.indexOf(input) == -1)
{
arguments.IsValid = false;
return;
}
}
return;
}
</script>
- The Ultimate Resource for IT Professional!