javascript - asp.net date validation with three drop down list -


i have 3 drop down list day month , year want validate selected date in asp.net using javascript or inbuild asp.net validation control.

thanks......

this java script code validate date format :

<script language="javascript" type="text/javascript">         function validatedate(args)         {         var date=args.value;                 var arr=date.split('/');          if(arr.length!=3)         {         args.isvalid=false;         return;         }         var day;         if(arr[1]=='08')         {         day=parseint('8');         }         else if(arr[1]=='09')         {         day=parseint('9');         }         else         {             day=parseint(arr[1]);         }                var month;               if(arr[0]=='08')         {         month=parseint('8');         }         else if(arr[0]=='09')         {         month=parseint('9');         }         else         {             month=parseint(arr[0]);         }         var year=parseint(arr[2]);         var boolday=false;         var boolmonth=false;         var boolyear=false;         if(!isnan(year))         {             if(1800<year&&year<2100)             {                   boolyear=true;                       }         }            if(!isnan(month))         {                    if(0<month&&month<13)             {                     boolmonth=true;             }         }         if(!isnan(day))         {         var val=32;         if(boolmonth)         {              if(month==2)              {              if(boolyear)              {                 if(year%4==0)                 {                 val=30;                 }                 else                 {                 val=29;                 }              }               }              else if(month==4||month==6||month==11||month==9)              {              val=31              }         }          if(0<day&&day<val)         {             boolday=true;         }         }              if(boolyear&&boolmonth&&boolday)         {          args.isvalid=true;         }         else         {         args.isvalid=false;         }          }         </script> 

and can validate date entered in 3-dropdownlist concatinate 3 values , passing function


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -