Validate on a User control

rfazendeiro

Centurion
Joined
Mar 8, 2004
Messages
110
I have a very simples user control for a user to enter a date. I know i should use the datetimepicket but i got this project where they already used this control.

The control has 3 dropdownlists that are day, month and year. Each of these dropdownlists theere is a default value with a string saying Day, Month and Year respectavly. and besides that, the control does not see if the motnth has 31 ou 30 days.

my problem is that i can only validade the date inputed pu the user after a submit and i wanna change that. I would like to be able to validate this before a submit, just like a asp.net validator does.

any sugestions on how to acomplish this?


P.S --> i post in attach the control code


thx to all
 

Attachments

Can you use the autopostback for the month dropdownlist and when the month is changed you rebuild the day combobox with the correct number of days??
 
I can do that but that would require that the user insert the month first.

What i could do is when the month is selected i check to see if the day is valid. If not i try to find the next valid day.

for example a user chooses 31 of febuary. In the postback i would check if it's a valida date, if not calculate the nearest valid day. In this case 28 (or 29 depending) of febuary

i'll give it a try

thx for the reply
 
Back
Top