简体   繁体   中英

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. 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.

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 checkboxes with other fields are in the updatePanel

Each field is in dl tag with 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.

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 :)

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.

Thanks for any hints,

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

Thanks for help, bye

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

  • Large amount of form data (such as Viewstate) being posted. 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). 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).

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.

  • 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 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

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

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

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

You need to set update Panel properties update mode to Conditional instead of 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. Update panel mode should be conditional. Check the triggers as well

Try with these properties values in 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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