Solved

ASP.NET 2.0 RangeValidator

Posted on 2007-03-31
4
1,139 Views
Last Modified: 2011-10-03
How can today's date be dynamically put in the MaximumValue of a RangeValidator for dates in a FormView without hardcoding?
0
Comment
Question by:ksfok
  • 2
4 Comments
 
LVL 1

Expert Comment

by:jroth-haj
ID: 18830033
Hello,
you should set it in the the "code behind".
Search for the best event to do this. then set the property.
Which is then best event  depends on the structure of your site.
0
 

Author Comment

by:ksfok
ID: 18830912
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.
0
 
LVL 15

Accepted Solution

by:
Thogek earned 250 total points
ID: 18831290
How about settig the MaximumValue property to something like
    DateTime.Today.ToString()
    DateTime.Today.ToString("yyyy/MM/dd")

More about RangeValidator.MaximumValue at http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolsrangevalidatorclassmaximumvaluetopic.asp.
0
 
LVL 1

Assisted Solution

by:jroth-haj
jroth-haj earned 250 total points
ID: 18831551
try this
RangeValidator myControl = ctype(FindControl("myDateRangeValidator"),RangeValidator);
myControl .valHireDateRange=" DateTime.Today.ToString("yyyy/MM/dd")"
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now