Reputation: 588
I have a repeater that houses a gridview. That gridview needs to be editable, and to make for a more fluid experience, I have the gridview wrapped with an update panel. There are n number of update panels on the page based on this. Everything is working perfectly fine, but I'm asking because I'm afraid of problems that may arise, such as postback size. Is this the best way to do this? Are there any pitfalls I'm not seeing?
Upvotes: 0
Views: 192
Reputation: 56688
You have an eligible concern.
First thing to know if that UpdatePanel
post the whole page to the server, always, even including whole ViewState content. Nothing you can do about it, just make sure you acknowledge that. So if your page is very large and you notice significant lags in how the app works, you might want to consider a different approach, perhaps with manual async calls, or something like that.
Second thing immediately follows - whenever an UpdatePanel
does a postback, server does the full page life cycle, and then just a part inside the UpdatePanel
is updated on the page. Again, nothing you can or should do, this is just how UpdatePanel
works. People are sometimes surprised by that fact while debugging, so it was worth mentioning.
Third thing is specific for your case, cause you have multiple UpdatePanels
on the page. By default if one of them does a postback, all other panels do a postback as well, and consequently they all are updated. Maybe this is a desired behavior, maybe not. If not, you can set UpdateMode
property of each UpdatePanel
to Conditional
, and they will be update only GridView
inside triggers an update. More on this here.
These and much more other details on UpdatePanel
s, can be found in this article.
Upvotes: 3