hi
In my page one asp.net Textbox to enter the date.
I need to validate the textbox value ( dd-mmm-yyyy format) should be less than or equal to Current Date using Javascript.
validation using javascript when press on enter button.
hi
In my page one asp.net Textbox to enter the date.
I need to validate the textbox value ( dd-mmm-yyyy format) should be less than or equal to Current Date using Javascript.
validation using javascript when press on enter button.
you can use compare validator like ...
<asp:CompareValidator ID="cmv" runat="server" ControlToValidate="txtDate"
Display="Dynamic" Operator="GreaterThanEqual" SetFocusOnError="True" Type="Date"></asp:CompareValidator>
and in code behind set value to compare today date
cmv.ValueToCompare = DateTime.Now.ToShortDateString()
Check this question http://stackoverflow.com/questions/511439/custom-date-format-with-jquery-validation-plugin
var myDate1= document.form1.Textbox2.value;
var date = myDate1.substring(0,2);
var month = myDate1.substring(3,5);
var year = myDate1.substring(6,10);
var myDate= new Date(year,month-1,date);
var today = new Date();
if (myDate>today)
{
alert("Today is before ");
}
else
{
alert("Today is after ");
}