Wednesday, 7 August 2013

Unable to validate the month and year using jscript

Unable to validate the month and year using jscript

I'm trying to validate month and year via two dropdowns in asp.net using
custom validator. But it isn't running dynamically
<script language="javascript">
function validateNumber(oSrc, args) {
var
month=document.getElementById('<%=ddlccExpirationMonth.ClientID
%>').value;
var year=document.getElementById('<%=ddlccExpirationYear.ClientID
%>').value;
if ((month<DateTime.Now.Year) || ((year == DateTime.Now.Year &&
month < DateTime.Now.Month))
{
args.IsValid = false;
} else {
args.IsValid = true;
}
}
</script>

No comments:

Post a Comment