6

I am using UpdatePanel for asp.net Controls. So, to validate it I am using jquery onEachRequest. It is also working fine.

But, main issue is that It stops executing postback of DropDownList. Means, It does not postback to retrive data.

My Code :

function onEachRequest(sender, args) {
    if ($("#form1").valid()==false) {
          args.set_cancel(true);
    }
}
function pageLoad() {           
      $('#<%= btnPayment.ClientID %>').click(function () {
            $("#form1").validate({
                rules: {
                    <%=txtName.UniqueID %>: {
                        required: true
                    }
                }, messages: {
                    <%=txtName.UniqueID %>:{
                        required: "Please enter Name."
                }
                }
            });

        var prm = Sys.WebForms.PageRequestManager.getInstance();
        prm.add_initializeRequest(onEachRequest);
      });
}

How to solve this issue ?

2 Answers 2

2

I used below code to solve my problem :

function onEachRequest1(sender, args) {
     args.set_cancel(false);
}

$('#<%= Dropdown Id.ClientID %>').change(function () {
     var prm = Sys.WebForms.PageRequestManager.getInstance();
     prm.add_initializeRequest(onEachRequest1);
});
Sign up to request clarification or add additional context in comments.

Comments

1

Does your DropDown have the AutoPostBack-Attribute?

<asp:DropDownList ID="someIdHere" runat="server" AutoPostBack="true" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.