TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chevy Mark Sunderland
NA
188
166.8k
CompareValidator variables dates
May 10 2012 4:10 AM
Hello there.
First of all I must say that I am a newbie when it comes to net.
Here is my problem.
In this net code I need check that the inserted date in the form is lower than today and open alert window for the message of error if the date is higher.
But this code not working.
e.g.:
1) Date inserted in the form: 01/05/2012 I need `date is valid` because 01/05/2012 is lower vs 10/05/2012, instead my code print `date not valid`
2) Date inserted in the form: 11/05/2012 I need `date not valid` because 01/05/2012 is higher vs 10/05/2012, instead my code print `date is valid`
Can you help me?
If you have link for similar task, please give it me.
Your help would be very appreciated.
thanks for your time and hints.
<asp:CompareValidator ID="CompareValidator1" runat="server"
ErrorMessage="date not valid"
ControlToValidate="DataReg"
Type="Date"
Operator="GreaterThanEqual"
ValueToCompare='<%# DateTime.Now.ToString("d") %>'
CssClass="redb">
</asp:CompareValidator>
protected void Page_Load(object sender, EventArgs e)
{
if (DataReg.Text != null)
{
CompareValidator1.ValueToCompare = DateTime.Now.Date.ToShortDateString();
}
}
Reply
Answers (
2
)
Crystal Report?
Three Tier Architecture