OnClientClick not working

15,797

Solution 1

Just to be sure: ValidateDropDown has been defined in the JavaScript, right? OnClientClick is what is executed on the client side, i.e. the javascript.

The other thing might be that the syntax for OnClientClick might need to be different, such as: OnClientClick="ValidateDropDown()"

Solution 2

Your question is a little unclear on which function isn't firing (the JS OnClientClick or the server-side OnClick), but if it's the server-side, make sure ValidateDropDown() is returning true. If it returns false or null or something, the server method won't fire.

Can you post your code for ValidateDropDown? Have you verified that it's firing?

Share:
15,797
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    I have a back and next button in that there is a OnClientClick validation function.

    This function is not called when i click on that, Please help me

    Code has given below:

    <asp:Button ID="btn_view1_back" runat="server" Text="Back" 
                CausesValidation="False" ValidationGroup="Form2" />
    
    <asp:Button ID="btn_View1_Next" runat="server" CausesValidation="true" Text="Next" 
                ValidationGroup="Form2" OnClientClick="return ValidateDropDown();" 
                UseSubmitBehavior ="true" />