I'm using a file manager-type WebControl
that does lots of postbacks. It's placed inside a Page
that is relatively complex. I would like to prevent the WebControl
from causing the whole Page
to go through the lifecycle. An UpdatePanel
helps a little, but not enough.
Is there any way to isolate the WebContro开发者_StackOverflow中文版l
from the rest of the Page
? The only way I can think of is sticking the WebControl
in a separate Page
and creating an iframe
in the original Page
. Unfortunately that also means my WebControl
properties/settings are no longer in the original Page
. If I want two instances of the WebControl
with different settings, then I have to create a Page
for each setting and reference the correct one in my iframes
. Not quite as "drag & drop" as I would like. Any other suggestions?
Hard to tell, you can't prevent a control from going through lifecycle; is there anyway to identify though, that during a certain page postback, you prevent the code from running in each event handler by doing something like:
if (_shouldNotRun == true)
return;
//Event handler code
Essentially, figuring out some way to indicate whether the control should run may be an option. IFrame would work, but yes you have to deal with the issues you mentioned. Can you give more detals to the problem?
HTH.
Not 100% sure what events possible to override that are called on PostBack. A good source for the Life Cycle of a page (http://msdn.microsoft.com/en-us/library/ms178472.aspx)
But it sounds as it would be better to remake your control to create Ajax webservice requests for the functions that are possible to prevent most of the postback's?
Cheers, Stefan
精彩评论