如何在使用大量用户控件时在Web表单页面中回发? [英] how to postback in web form page when using lots of usercontrols?

查看:85
本文介绍了如何在使用大量用户控件时在Web表单页面中回发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想在一个asp.net网页表单中使用一些用户控件。 usercontrols使用ajax加载。没关系,但usercontrols的缺点是什么?我需要一些用户控件的建议,我是否应该使用它们?或者您更喜欢ajax更新面板?

谢谢大家

Hi guys,
I want to use some usercontrols in one asp.net web form. usercontrols load with ajax. That's ok but what are the disadvantages of usercontrols? I need some advices for usercontrols, should I use them or not? Or you prefer ajax update panel?
Thank you all

推荐答案

当您考虑可用性,碎片化缓存以提高性能等时,UserControls总是一个不错的选择。所以这里它可以是针对您的网页的用户控件的数量。 Ajax更新面板不能替代用户控件,因为我们可以有多个更新面板来加载多个用户控件,具体取决于您需要如何处理部分更新。



回发与正常页面一样正常。如果要动态加载某些时间,则必须相应地处理它们。唯一的限制是,如果您想在应用程序之间共享它,就像我们使用自定义控件一样无法完成。



您可以查看以下链接,该链接提供有关生命周期用户控件以及用户控制事件触发顺序的信息。

http://blogs.thesitedoctor.co.uk/tim/2006/06/30/Complete+Lifecycle+Of+An+ASPNet+Page+And+Controls.aspx [ ^ ]



希望这有帮助
UserControls can be a good option always when you intent re usability, fragmented caching for performance improvements etc. So here it can be number of usercontrols which targets your webpage. Ajax update panels are not a substitute for usercontrols since we can have multiple update panels to load multiple usercontrols depending upon how you need to handle partial updates.

Postbacks will be just like normal as a normal page . If you are loading dynamically some times you have to handle those accordingly. The only limitation is if you want to share it across the applications it cannot be done as we do with custom controls.

You can check the below link which gives an idea about the lifecycle usercontrols and also order of the usercontrol control events fire .
http://blogs.thesitedoctor.co.uk/tim/2006/06/30/Complete+Lifecycle+Of+An+ASPNet+Page+And+Controls.aspx[^]

Hope this helps


这篇关于如何在使用大量用户控件时在Web表单页面中回发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆