G
gane kol
Hi
I have a custom validator that validates a dropdownlist with a listitem
value as "". But the clientvalidation function is never called.
but if i use value = "0" and check it in javascript, it works fine. It might
be silly, but it is eating my time. 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; } }
Thanks
gane
I have a custom validator that validates a dropdownlist with a listitem
value as "". But the clientvalidation function is never called.
but if i use value = "0" and check it in javascript, it works fine. It might
be silly, but it is eating my time. 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; } }
Thanks
gane