__doPostBack reloads the entire page, not just UpdatePanel

In my javascript, I have the following line:

__doPostBack('MyPanel', MyParam); 

In my code behind, I use MyParam to query the database and bind the result to the gridview that is inside the MyPanel update panel. The updated file of the updated panel is set to a conditional state, and in the reverse side of the code I have MyPanel.Update();

Update panels work fine when I sort and swap; only the panel is updated. However, when I launch the update panel using my javascript, I see that the traffic in firebug shows that the whole page is being updated.

What's the solution?

Thanks.

+4
source share
1 answer

My information: your update panel is inside the naming container, so its client-side identifier will be slightly different from the server-side identifier. This means that you are passing the wrong __EVENTTARGET parameter to the side __doPostBack client, and your partial side __doPostBack has become complete (which means not async).

So, change the client code to:

 __doPostBack('<%= MyPanel.ClientID %>', MyParam); 

should solve the problem.

By the way, you can get the second ( MyParam in your code) parameter from the server side:

 var arg = Request.Params.Get("__EVENTARGUMENT"); 
+15
source

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


All Articles