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)
args.IsValid = false;
args.IsValid = true;
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL