Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
Validate WebCombo Selected selectedIndex = -1 (newbe needs help!)
posted

I want to validate a WebCombo on the client side using a custom validator. Validating that a dropdown selection has been made after the "Go" button is selected. Which means that I want to load/activate the javascript function at the end of the last page event and before selecting the "Go" button.

JavaScript function:

function ComboCheck(sender, args){
        var combo = igcmbo_getComboById('<%=wcPortName.ClientID %>').selectedIndex;
        if(selectedIndex == -1){ 
          args.IsValid = false;
  }
    return args.IsValid;
  }

Validator:

       <asp:CustomValidator id="validCustCombo" runat="server" CssClass="Text" ErrorMessage="Please make a selection in the dropdown!"
        ClientValidationFunction="ComboCheck"></asp:CustomValidator></TD>

  1. First does the function look right?
  2. How do I call the code using VB (remember I am newbe). I only want to run the function when it calling it from the VB code (Like the click button handler)
Parents Reply Children
No Data