Link to home
Start Free TrialLog in
Avatar of ksfok
ksfok

asked on

ASP.NET date range validation

In Page_Load() of a regular ASP.NET page the below code can be used for date range validation:
                 RangeValidator1.Maximum = DateTime.Today.ToShortDateString()

But how can that code be put  in a Formview's Edit or Insert Template for a range validator's MaximumValue=""?

Thanks
Avatar of jroth-haj
jroth-haj
Flag of Germany image

Hello,
it's depending on the structure of the page.
mybe on page_load event the object in't yet available.
try an later event.
you also should use "findcontrol" to find the object RangeValidator1
Avatar of ksfok
ksfok

ASKER

The following code:
Control myControl = FindControl("valHireDateRange");
generates:
The type or namespace name 'Control' could not be found (are you missing a using directive or an assembly reference?)

Please advise.
ASKER CERTIFIED SOLUTION
Avatar of jroth-haj
jroth-haj
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial