After validating successfully, how to modify input for smarter displaying

47 Views Asked by At

My case is that I have a textbox for Age input. I use RegularExpressionValidator control to validate the input, like this:

<asp:RegularExpressionValidator ... ValidationExpression="\s*\d+\s*" ... />

The validation accepts digit inputs which maybe include whitespaces on the beginning or at the end of numbers. So if one user types " 32 " into the textbox, the input is legal. But afterwards I want the text box shows the better form, "32" - throw away all whitespaces.

I know it is possible to process by javascript, however is there a shorter way? or another more powerful validator control?

0

There are 0 best solutions below