Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation on a group of controls 1

Status
Not open for further replies.

ITking2009

Programmer
Aug 4, 2009
23
US
Hi,
Here's what i need to do, i need to make sure that the user has entered something in atleast one of the 6 text boxes before they are taken to another page on the website after the submit button is clicked.

i used to do the same using client side javascript in classic asp so trying to understand if i need to use the same approach or i could use the validation control for this.

Thanks.
 
You should verify both serverside and clientside just in case a user turns off javascript in their browser. On the serverside, you can use the CustomValidator control.
 
i tried that but couldnt figure out which control it shoudl be tied to as there are 6 textboxes and any one of them having a value should validate the page.
what am i missing??
 
You would use the server_validate event of the custom control. In there, you would have to check each textbox. If they are all blank, then set args.isvalid = true, otherwise false.

You can use a validation summary control to display the error.

There are plenty of examples in vs help and online
 
all the examples i am able to find have one control tied to one validation , can you share an example where multiple controls are tied to one custom validation control.
thanks.
 
You don't tie the validation control to any one control. Just use the ServerValidate event.


If textbox1.text.trim <> string.empty
args.isvalid = false
...

etc.
 
Thanks Jbenson001, this is true for the server side but for the client side how do i get the validations generated?
Thanks.
 
ahh...i should have read you mentioned for server side dammn....Thanks for spending time with me ont his.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top