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.
ControlToValidate="DataReg"
Type="Date"
Operator="GreaterThanEqual"
ValueToCompare='<%# DateTime.Now.ToString("d") %>'
CssClass="redb">
protected void Page_Load(object sender, EventArgs e)
{
if (DataReg.Text != null)
{
CompareValidator1.ValueToCompare = DateTime.Now.Date.ToShortDateString();
}
}
Jiteendra SampathiraoPosted May 10, 2012, 6:31 AM
http://weblogs.asp.net/sahannet/archive/2011/02/01/date-compare-validator-control-asp-net.aspx
Hope it helps...
Chevy Mark SunderlandPosted May 10, 2012, 7:32 AM