Reputation: 820
I'm new to using c# in asp.net
I was just wondering what the best methods of validation are for when it comes to checking a textbox that has to be number's (and 1 decimal point) only, I've read about ajax but I understand that this only works if the client supports it, so I'm now looking into new methods.
Also do these validation methods have the ability to prevent a event such as a button press from triggering and causing the web application to break?
Upvotes: 1
Views: 877
Reputation: 223422
Always validate data at client side as well as server side (in code behind). For example you can use the asp.net provided validation control which will provide you with Client side validation, In server side validation (in C#) you can implement your own logic for data validation. For example in your case you can use double.TryParse
to see if the string entered in the TextBox
is a valid double number.
The reason to have Both types of validation is:
Upvotes: 5