简体   繁体   English

更新面板工作非常慢

[英]Update Panel working very slow

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. 注册一个选项可以选择几个选项,并根据这些regiester字段是否可见,是否需要。 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. 我想到了所有字段都在updatePanel中,当用户更改注册选项时,我会在服务器端设置这些字段的可见性。

It works but incredibly slow and whats more on the FF I have the given error: 它的工作原理但速度极慢,而且在FF上有更多我有给定的错误:

The state information is invalid for this page and might be corrupted 状态信息对此页面无效,可能已损坏

3 checkboxes with other fields are in the updatePanel updatePanel中包含其他字段的3个复选框

Each field is in dl tag with runat="server> 每个字段都在dl标记中,其中runat="server>

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. 我必须这样做,因为“必需”选项的原因我只是将css类添加到此dl(需要在javascript验证中。如果字段应该可见我为给定的dl设置visible =“false”然后该字段,例如FirstName回复后,标题等等是不可见的。

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 :) 为什么它需要这么长时间(在本地主机上约4分钟)而在Firefox中它并没有真正起作用(当我使用调试时我认为该过程在ff上完成没有错误,我根本不明白:)

If update Panel is so weak what would be other option to change visibility and adding required class to all dls. 如果更新Panel非常弱,那么更改可见性和向所有dls添加所需类的其他选项。 Logic is quite complicated and has to make query to DB so simple javascript would be quite tricky. 逻辑非常复杂,必须对DB进行查询,因此简单的javascript非常棘手。

Thanks for any hints, 谢谢你的任何提示,

Oh and I'm using ASP.Net and cant upgrade on this project. 哦,我正在使用ASP.Net并且无法升级此项目。

Thanks for help, bye 谢谢你的帮助,再见

Without code to look at, here are general things which will make an UpdatePanel slow: 没有代码可以查看,这里有一些使UpdatePanel变慢的一般事情:

  • Large amount of form data (such as Viewstate) being posted. 发布了大量表单数据(例如Viewstate)。 Uploaded data is often slower than downloading data (depending on connection type, such as a home connection where uploads can be 5x slower than downloads). 上传的数据通常比下载数据慢(取决于连接类型,例如上传速度比下载慢5倍的家庭连接)。 Even though you can't see it, every form field on the page is posted back to the server (even if its not in the UpdatePanel). 即使您看不到它,页面上的每个表单字段都会回发到服务器(即使它不在UpdatePanel中)。

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. 我建议您在Firebug中查看您的请求/响应数据,并确保您的异步请求小于5K,并且您的响应不超过20K。

  • A slow process on the server which is running when the UpdatePanel is posted. 发布UpdatePanel时正在运行的服务器上的缓慢进程。 How does your code perform when the UpdatePanel is removed? 删除UpdatePanel后,您的代码如何执行?

  • JavaScript errors (yours and Microsoft's). JavaScript错误(你的和微软的)。 Here is a link to a known bug and a fix that I have used myself: http://support.microsoft.com/?kbid=2000262 以下是我自己使用的已知错误和修复的链接: http//support.microsoft.com/? kbid = 2000262

  • Massive DOM manipulation (doesn't sound like this is the case for you). 大规模的DOM操作(听起来不是这样的)。

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 顺便说一句,搜索您报告的错误消息可能会导致许多原因: http//www.google.com/search? aq = f&sourceid = chrome&ie = UTF-8&the = state + information + is++++++++++++++++ 页面+和+可能被+ +损坏

As always, minimize or remove dependencies on ViewState...it's the source of many problems and enables poor design decisions. 与往常一样,最小化或删除对ViewState的依赖...它是许多问题的根源,并且能够做出糟糕的设计决策。

You need to set update Panel properties update mode to Conditional instead of Always . 您需要将更新面板属性更新模式设置为“ Conditional而不是“ Always Limit the number of controls you put into one update panel 限制放入一个更新面板的控件数量

You might want to check, Page events etc. Research on page directive and property AutoEventWireup Since performance is the issue you highlighted, you might want to check that as well. 您可能想要检查,页面事件等。研究页面指令和属性AutoEventWireup由于性能是您突出显示的问题,您可能还想检查它。 Update panel mode should be conditional. 更新面板模式应该是有条件的。 Check the triggers as well 检查触发器

Try with these properties values in Page directive . Page directive尝试使用这些属性值。 This is always at the top of your page. 这始终位于页面顶部。 Let other properties be there as they were before. 让其他属性像以前一样存在。 Update panels should not be slow like you are reporting. 更新面板不应该像报告一样慢。

 <%@ Page ViewStateEncryptionMode="Never" EnableViewStateMac="false"
       EnableEventValidation="false" %>

I would also like to add that if your database query that you mentioned is complex, is taking a very long time, then the problem lies not with aspx page or update panel, but with your database query. 我还想补充一点,如果您提到的数据库查询很复杂,需要很长时间,那么问题不在于aspx页面或更新面板,而在于您的数据库查询。 You will then need to profile your query and check how much time it's taking to execute. 然后,您需要对查询进行概要分析,并检查执行所花费的时间。 The way to go in that case would be to fine tune your query at database level. 在这种情况下,方法是在数据库级别微调您的查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM