阻止一个控件的页面生命周期

发布于 2024-10-08 03:10:40 字数 567 浏览 4 评论 0原文

我正在使用文件管理器类型的 WebControl 来执行大量回发。它放置在相对复杂的Page 内。我想防止 WebControl 导致整个 Page 经历生命周期。 UpdatePanel 有一点帮助,但还不够。

有没有办法将 WebControlPage 的其余部分隔离?我能想到的唯一方法是将 WebControl 粘贴在单独的 Page 中,并在原始 Page 中创建一个 iframe >。不幸的是,这也意味着我的 WebControl 属性/设置不再位于原始 Page 中。如果我想要两个具有不同设置的 WebControl 实例,那么我必须为每个设置创建一个 Page 并在我的 iframes 中引用正确的页面>。不像我想要的那样“拖放”。还有其他建议吗?

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 WebControl 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

舞袖。长 2024-10-15 03:10:40

很难说,你无法阻止控件经历生命周期;无论如何,有没有办法确定,在某个页面回发期间,您可以通过执行以下操作来阻止代码在每个事件处理程序中运行:

if (_shouldNotRun == true)
   return;

//Event handler code

本质上,找出某种方法来指示控件是否应该运行可能是一种选择。 IFrame 可以工作,但是你必须处理你提到的问题。您能否提供有关该问题的更多详细信息?

HTH。

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.

岛徒 2024-10-15 03:10:40

不能 100% 确定哪些事件可以覆盖在回发上调用的事件。页面生命周期的一个很好的来源(http://msdn.microsoft.com/en-us/library/ms178472.aspx)

但是听起来最好重新制作控件来为页面创建 Ajax Web 服务请求可以阻止大多数回发的功能吗?

干杯,
斯特凡

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文