protected void check(object sender, ServerValidateEventArgs args)
{
string value = DropDownList1.SelectedValue ;
var tim = DateTime.Now.ToLongTimeString();
var compare = DateTime.Now.AddHours(6).ToLongTimeString();
if (value.Length> compare.Length)
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
n dropdownlist used:
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>12:00 a.m.</asp:ListItem>
<asp:ListItem>1:00 a.m.</asp:ListItem>
<asp:ListItem>2:00 a.m.</asp:ListItem>
<asp:ListItem>3:00 a.m.</asp:ListItem>
<asp:ListItem>4:00 a.m.</asp:ListItem>
<asp:ListItem>5:00 a.m.</asp:ListItem>
<asp:ListItem> 6:00 a.m.</asp:ListItem>
<asp:ListItem>7:00 a.m.</asp:ListItem>
<asp:ListItem ...
Go to the complete details ...