我可以在 aspx 页面上对每件事使用多视图和视图吗?
简而言之,我会遇到哪些限制?
使用
vs08,网络应用程序
注意
您能想到的或遇到的任何缺点,
例如关于编码、回发、事件处理、访问视图内的控制属性
in short what are the limitations i will experience?
using
vs08, webapplication
note
any disadvantage u can think of, or have encountered
e.g. regarding coding, postback, event handling, accessing properites of control within the view
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我能想到的两个最大的问题:
1)隐藏页面仍然加载。 Asp.net 将在 MultiView 中的所有视图(包括隐藏视图)上运行几乎整个页面生命周期。
对我来说这是最大的缺点。这意味着性能较慢,并且存在隐藏页面抛出异常的风险。如果您的视图上有数据控件,您将加载大量冗余数据。
请参阅,例如 http ://msmvps.com/blogs/luisabreu/archive/2008/02/20/multiview-control-should-you-use-it.aspx 和 如何阻止 Web 控件加载子控件?
2) 隐藏页面生成视图状态
请参阅多视图控件如何处理其视图状态?< /a>.
这意味着向浏览器发送和从浏览器发送的 HTML 较大,这意味着传输速度较慢。此外,Asp.net 确实会发生 ViewState 错误,并且可以说,更臃肿的 viewstate 更可能导致这些错误。
The two biggest issues I can think of:
1) Hidden Pages are still loaded. Asp.net will run almost the full page lifecycle on all Views in a MultiView, including the hidden views.
For me this is the biggest drawback. It means slower performance, and a risk of hidden pages throwing exceptions. If you have data controls on your views, you'll be loading a lot of redundant data.
See, eg http://msmvps.com/blogs/luisabreu/archive/2008/02/20/multiview-control-should-you-use-it.aspx, and How to stop a web control from loading child controls?
2) Hidden Pages generate View State
See How does the Multiview control handle its Viewstate?.
This means larger HTML sent to and from the browser, which means slower transmission. Also, ViewState errors do happen with Asp.net, and arguably a more bloated viewstate therefore makes these more likely.
你也许可以,但这可能不是一个好主意。
这里有 3 个例子,我不会在所有事情上都使用它。
You probably could, but it might not be a good idea.
Here are 3 examples where I would not use it for every thing.