I have a textbox where I only want the user to be able to enter numbers, and I don't want the user to be able to leave it blank either. I am trying to use a CustomValidator to accomplish this.

I have a button on the page that, when clicked, causes all the validators except my CustomValidator to fire. I've looked at a few tutorials, but can't tell what I'm doing wrong. I'm guessing I just have a property set to the wrong value or something. Should I have EnableClientScript set to false since I want the validation to be server-side? Should ValidateEmptyText be true or false?

Here is the declaration of the CustomValidator:

ErrorMessage="You must enter a temperature."></asp:CustomValidator>

And here is my OnServerValidate method. Right now it only checks if the textbox is blank.

protected void ValidateTemperature(Object sender, ServerValidateEventArgs args)
if (txtTemperature.Text.Equals(""))
args.IsValid = false;

args.IsValid = true;