In my javascript, I have the following line:
__doPostBack('MyPanel', MyParam);
In my code behind, I use MyParam to query a database and bind the result to a gridview that's inside the MyPanel updatepanel. The updatemode of the updatepanel is set to conditional and in the postback part of the code I have MyPanel.Update();
The updatepanel works fine when I'm doing sorting and paging; only the panel is refreshed. However, when I trigger the updatepanel with my javascript, I see the traffic in firebug showing that the entire page is being refreshed.
What's the solution?
Thanks.
My assuption: your update panel is located inside the naming container, so its id in the client side will be a little bit different from the server side ID. This means you pass the wrong __EVENTTARGET
parameter to the client side __doPostBack
function and your partial postback became full(meaning not async).
So changing your client code to:
__doPostBack('<%= MyPanel.ClientID %>', MyParam);
should solve the problem.
BTW, you could get the second(MyParam
in your code) parameter from the server side:
var arg = Request.Params.Get("__EVENTARGUMENT");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With