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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the best way to validate a User Control

Status
Not open for further replies.

DarwinIT

Programmer
Apr 25, 2008
142
US
I have found a calendar control that I'm inserting into my pages where dates need to be entered. What is the best way to validate that only valid dates are entered if the user types something. I'm wondering if I have to put the validator in the control module itself. Since sometimes the date will be required and other times it won't, I might have to create two controls - one required and one optional??
 
Thanks!
I was asking more along the lines of a strategy to validate user controls of any type. I was not aware of the CompareValidator. That is pretty slick. I think the solution here is to dynamically assign the controltovalidate to provide the name of the user control assigned when the page is created ControlToValidate="<%=GetClientID%> That keeps everything in the current page.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top