Reputation: 7525
I have a page that dynamically loads multiple user controls on a page. I have a few buttons on each user control that cause a server side event that does some processing related to the user control that triggerred the action.
The problem I run into is that this button click causes the entire page to reload (as all the dynamically loaded controls need to be reloaded on every postback) for all the user controls that makes the page really slow.
Is there a way to tell .NET to ignore the other user controls when a user is interacting with one of the user controls?
All user controls are within updatepanels that have mode set to conditional.
Upvotes: 0
Views: 2826
Reputation: 2149
You should be able to use UpdatePanels in the scenario you mentioned. There must be something specific to your implementation causing the whole page to refresh. I would suggest stripping it down to isolate the problem. I created the following sample and it worked as expected... only the triggered UpdatePanel was refreshed:
When I click either button inside the UpdatePanel, only that panel refreshes (even though LoadControl is called twice on each async postback to recreate the control hierarchy).
Upvotes: 0
Reputation: 88082
Drop the update panels and switch to using jquery and JSON.
You can focus your code a bit more and should be able to forgo all the control loading crap.
The fundamental problem is that the updatepanels still require the full page to execute in order to send back just the tiny bit of data you want. By moving towards jquery in combination with either page methods or web service methods your page won't have to be reconstituted for each "panel" update.
Upvotes: 3
Reputation: 7713
To answer your question specifically. No. There is no way to "tell .NET to ignore the other user controls". You can, of course, tell your application to ignore things. Perhaps you are missing some if (!Page.IsPostBack) {}
statements?
Upvotes: 0