Validating jQuery with C # update panel

I am using UpdatePanel for asp.net Controls. So, to test it, I use jquery onEachRequest . It also works great.

But the main problem is that it stops performing the DropDownList . So, it does not return data for data recovery. My code is:

 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 problem?

+6
source share
3 answers

I used the code below 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); }); 
+2
source

I found an answer that may be relevant to you:

fooobar.com/questions/983963 / ...

at least you should research in that direction

+1
source

Does your DropDown have an AutoPostBack attribute?

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

Source: https://habr.com/ru/post/983962/


All Articles