It is perfectly fine that the validation passes with leading or trailing spaces. The same thing would be ok if you attempted to run a TryParse or Convert on a numerical string with leading and/or trailing spaces. The numerical value is still valid, it just needs to be trimmed.
[Update]
When you postback your page and you want to work with the value in the Textbox as a numerical value, you would do something like this.
int value;
if( Int32.TryParse( YourTextBox.Text, out value ) == false )
{
}
double value;
if( Double.TryParse( YourTextBox.Text, out value ) == false )
{
}