To date must be less than from date
function datevalid(sender, args)
{
var str1 = document.getElementById("txtfrom").value;
var str2 = document.getElementById("txtto").value;
var dt1 = parseInt(str1.substring(0,2),10);
var mon1 = parseInt(str1.substring(3,5),10);
var yr1 = parseInt(str1.substring(6,10),10);
var dt2 = parseInt(str2.substring(0,2),10);
var mon2 = parseInt(str2.substring(3,5),10);
var yr2 = parseInt(str2.substring(6,10),10);
var date1 = new Date(yr1, mon1, dt1);
var date2 = new Date(yr2, mon2, dt2);
if(date2 < date1)
{
document.getElementById('CustomValidator1').innerHTML="From date must be Less than To date";
args.IsValid = false;
return;
}
Tuesday, July 8, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment