我陷入了 UpdatePanel 陷阱
我有一个很大的问题。 我正在 ASP.NET 3.5 中制作 CRM(客户关系管理)系统,
我的整个项目基于 DevExpress.com 控件和 UpdatePanels 的使用。
现在,我的一个页面是整个系统的中心页面,包含大量的可能性,因此包含大量的用户控件。
现在我的问题是,它变得非常非常慢,因为 UpdatePanel 正在重新发布整个页面,而不仅仅是更新面板。 我们在弹出窗口出现前 3-4 秒进行交谈:(
有什么方法可以在不伤我脖子的情况下重构整个系统,使其远离 UpdatePanels 吗? 我是否可以优化 UpdatePanels 的使用?
ViewState 也绝对是巨大的。
有什么好的想法欢迎提出...
I have a very big problem. I am making a CRM (Costumer Relationship Management) System in ASP.NET 3.5
I have based my entire project on DevExpress.com controls and the use of UpdatePanels.
Now one of my pages, which is a central page in the whole system, contains a very big amount of possibilities and therefore a big amount of UserControls.
Now my problem is that it's getting really really slow because of the fact that UpdatePanels are reposting the entire page and not only the update panel. We are talking sometime 3-4 seconds before a popup window appears :(
Is there any way I can refactor this entire system away from UpdatePanels without breaking my neck?
Are there anyway I can optimize my use of UpdatePanels?
The ViewState is also absolutely giant.
Any good ideas are welcome...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
无法使用 UpdatePanels 发布整个页面。 我会尝试以下几件事来代替重新设计应用程序:
There's no way to get around posting the entire page using UpdatePanels. In lieu of redesigning the app here are a couple things I'd try:
由于您是 DevExpress 用户,您可能会考虑花一点时间来学习他们的 CallbackPanel< /a> 这将允许您进行异步处理,而无需 UpdatePanel 的开销。
或者(如果我错了,请有人纠正我),但如果所有回发都是异步的(即在 UpdatePanel 中),那么理论上是否可以禁用整个页面的 ViewState(在Page 指令)没有负面后果? 当然,你必须完全测试它,但值得一试。
Since you're a DevExpress user, you might consider taking a little time to learn their CallbackPanel which will allow you to do asynchronous processing without the overhead of the UpdatePanel.
Alternatively (someone please correct me if I'm wrong) but if all of the postbacks are asynchronous (i.e. in an UpdatePanel), wouldn't it be theoretically possible to disable ViewState for the entire page (in the Page directive) without negative consequences? You'd have to test it completely off course, but it's worth a shot.
您必须将更新面板中包含的一些回发替换为真正的 AJAX 调用,即仅将操作所需的数据发送到服务器并仅返回更新视图需要什么,摆脱回发和 UpdatePanels。
(您会注意到我使用了“操作”和“视图”这两个术语 - 是的,我是 MVC 粉丝。您所处的情况是典型的使用 WebForms 和 ASP.NET AJAX 控件很容易陷入的混乱情况.)
You'll have to replace some of the postbacks contained in your update panels with real AJAX calls, i.e. send only the data that is required for the action to the server and get back only what's required to update the view, getting rid of the postback and the UpdatePanels.
(You'll notice my use of the terms 'action' and 'view' - yes, I am an MVC fan. The situation you are in is typical of the mess that is easily got into using WebForms and the ASP.NET AJAX controls.)
我一定是错过了什么。 为什么你的更新面板正在重新加载整个页面。 更新面板的目的是仅刷新该面板中的内容,不是吗?谢谢您的解释。 我想我们正在讨论重新发布页面而不是像我想象的那样重新绘制面板。
尝试关闭 ViewState,尤其是网格。
I must be missing something. Why is your updatepanel is reloading the entire page. The point of an updatepanel is to refresh only what is in that panel, isn't it? Thanks for the explanation. I guess we're talking about reposting the page and not redrawing the panel as I thought.
Try turning off ViewState, especially for grids.
对于所有感兴趣的人,我想添加一个有关如何删除客户端上的 Viewstate 数据的解决方案。 它确实给服务器带来了额外的负载,但如果您处于与我相同的情况并且拥有大量服务器功能并且需要承担客户端的负载,那么这很好。
让您的所有页面都从 BasePage.cs 派生,如下所示
现在您拥有了视图状态数据会话的密钥,而不是代码中的视图状态...
对于我来说,在每天有 1000-1200 名访客的网站上,这就像一个魅力。
For all Interested I want to add a solution on how to get rid of the Viewstate data on clientside. It does give the server an extra load but if you are in the same situation as me and have a lot of server power and need to take the load of the clientside this is nice.
Let all your pages Derive from BasePage.cs looking like this
Now you have a key to the viewstate data session instead of the viewstate in your code...
Works like a charm for me on a website with 1000-1200 daily visitors as well.