更新面板工作非常缓慢 [英] Update Panel working very slow

查看:47
本文介绍了更新面板工作非常缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个用户可以在其中注册的应用程序.在注册时,可以选择几个选项,根据这些regiester字段是否可见以及是否必需.我想到了所有字段都将位于updatePanel中的想法,并且当用户更改注册选项时,我将在服务器端设置这些字段的可见性.

I'm writing an app in which user can register. While registering the one may choose several options and according to these regiester fields are visible or not and are required or not. I came up with an idea that all fields will be in in the updatePanel and when users changes registration options I would set visibility of these fields on the server side.

它可以工作,但是速度非常慢,而且在FF上还有给定的错误:

It works but incredibly slow and whats more on the FF I have the given error:

状态信息对于无效此页面,可能已损坏

The state information is invalid for this page and might be corrupted

3个带有其他字段的复选框位于updatePanel中

3 checkboxes with other fields are in the updatePanel

每个字段都在dl标记中,并带有 runat ="server>

Each field is in dl tag with runat="server>

我必须这样做,因为它是"required"选项的原因,我只是将css类添加到此dl中(在javascript验证中需要.如果字段可见,则为给定的dl设置visible ="false",然后将该字段设置为例如,带有标题等的名字在回发后可见.

I had to do it like that cause for "required" option I simply add css class to this dl (need in in javascript validation. If field should be visible I set visible="false" for given dl and then that field for example FirstName with title and so on isn visible after postback.

我做错什么了吗?为什么要花这么长时间(在本地主机上大约4分钟),而在firefox中却没有真正的作用(当我使用debug时,我认为该过程完成了,而ff上没有错误,我一点也不明白:)

Am I doing something wrong ? Why does it take so long (~4 min on localhost) and in firefox it doesnt really work (when I use debug I think that process completes without errors on ff, I dont understand that at all :)

如果更新面板太弱,则可以使用其他方法来更改可见性并将必需的类添加到所有dl.逻辑非常复杂,必须向数据库进行查询,所以简单的javascript会非常棘手.

If update Panel is so weak what would be other option to change visibility and adding required class to all dls. Logic is quite complicated and has to make query to DB so simple javascript would be quite tricky.

感谢任何提示,

哦,我正在使用ASP.Net,并且无法对此项目进行升级.

Oh and I'm using ASP.Net and cant upgrade on this project.

感谢您的帮助,再见

推荐答案

无需查看代码,以下是会使UpdatePanel变慢的常规操作:

Without code to look at, here are general things which will make an UpdatePanel slow:

  • 要发布的大量表单数据(例如Viewstate).上载的数据通常比下载的数据要慢(取决于连接类型,例如家庭连接,其中上载的速度可能比下载的速度慢5倍).即使您看不到它,页面上的每个表单字段也会被发回到服务器上(即使它不在UpdatePanel中也是如此).

我建议您在Firebug中检查您的请求/响应数据,并确保您的异步请求小于5K,并且您的响应不超过20K.

I would suggest going through your request/response data in Firebug and making sure that your async requests are less than 5K and your responses are no more than 20K.

  • 发布UpdatePanel时正在运行的服务器上的缓慢进程.删除UpdatePanel后,您的代码如何执行?

  • A slow process on the server which is running when the UpdatePanel is posted. How does your code perform when the UpdatePanel is removed?

JavaScript错误(您和Microsoft的错误).这是我自己使用的已知错误和修复程序的链接: http://support.microsoft.com/?kbid = 2000262

JavaScript errors (yours and Microsoft's). Here is a link to a known bug and a fix that I have used myself: http://support.microsoft.com/?kbid=2000262

大规模DOM操作(听起来好像不是这种情况).

Massive DOM manipulation (doesn't sound like this is the case for you).

顺便说一句,搜索您报告的错误消息有许多可能的原因: http://www.google.com/search?aq=f&sourceid=chrome&ie=UTF-8&q=The+state+information+is+invalid+对于+此+页面+和+可能+已损坏

BTW, searching for the error message you reported gives many possible causes: http://www.google.com/search?aq=f&sourceid=chrome&ie=UTF-8&q=The+state+information+is+invalid+for+this+page+and+might+be+corrupted

与往常一样,最小化或删除对ViewState的依赖...这是许多问题的根源,并可能导致不良的设计决策.

As always, minimize or remove dependencies on ViewState...it's the source of many problems and enables poor design decisions.

这篇关于更新面板工作非常缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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