G
gane kol
Hi
I have a custom validator that validates a drop downlist which has a
listitem value as "". but it is not working.
But if i assign "0" for the list item and check for "0" in javascript, it
works fine. Any ideas?
for eg:
<aspropDownList id=DropDownList1 runat="server">
<asp:ListItem Value="">select</asp:ListItem>
<asp:ListItem Value="1">test1</asp:ListItem>
<asp:ListItem Value="2">test2</asp:ListItem>
</aspropDownList>
<asp:CustomValidator id=CustomValidator1 runat="server"
ControlToValidate="DropDownList1" ErrorMessage="errrrrrrr"
ClientValidationFunction="testddl"></asp:CustomValidator>
function testddl(source, arguments) { var ddlDropDownList1 =
document.Form1.DropDownList1.options[document.Form1.DropDownList1.selectedIn
dex].value; if (ddlDropDownList1 == "") { arguments.IsValid = false; } }
I have a custom validator that validates a drop downlist which has a
listitem value as "". but it is not working.
But if i assign "0" for the list item and check for "0" in javascript, it
works fine. Any ideas?
for eg:
<aspropDownList id=DropDownList1 runat="server">
<asp:ListItem Value="">select</asp:ListItem>
<asp:ListItem Value="1">test1</asp:ListItem>
<asp:ListItem Value="2">test2</asp:ListItem>
</aspropDownList>
<asp:CustomValidator id=CustomValidator1 runat="server"
ControlToValidate="DropDownList1" ErrorMessage="errrrrrrr"
ClientValidationFunction="testddl"></asp:CustomValidator>
function testddl(source, arguments) { var ddlDropDownList1 =
document.Form1.DropDownList1.options[document.Form1.DropDownList1.selectedIn
dex].value; if (ddlDropDownList1 == "") { arguments.IsValid = false; } }