Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.NET 2.0 RangeValidator

Posted on 2007-03-31
4
Medium Priority
?
1,150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 750 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 750 total points
ID: 18831551
try this
RangeValidator myControl = ctype(FindControl("myDateRangeValidator"),RangeValidator);
myControl .valHireDateRange=" DateTime.Today.ToString("yyyy/MM/dd")"
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

604 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