How make sure sum of 2 text box is less then 5

liunx

Guest
Hi guys. I got a form that i ask the user to input data on it and it write it in sql server db. 2 of the field data i want their sum to be does not exceed a perticuler value for example 5 . How i can apply such bussiness needs in to my database and input form. I be happy if some one show me an example.ThanksThis is easy to achieve with the customValidator validation control.

This is the only validation control that does not require the controlToValidate attribute to be used.

So all you will need to do is:

1. Add a customerValidator tag to your page with an appropriate error message and give it a name for the OnServerValidate attribute.

2. Add code to the page to cover the call to the function you named in step two. This will need to return a boolean.

3. Add code to the function to sum the two numbers together and make sure they are less than 5.

If you have any problems with this then just let me know :)

Good luck.

p.s. if you dont already have a validationSummary tag in the page then you may want to add this to display the error message.
 
Back
Top