About the asp.net page dynamic load user control, the reason for "failed to load view state" appears __.net

Source: Internet
Author: User
No title page ABC

Let's take a look at the "State of view", that is, viewstate, in our view of the ASP.net generated page code, we can see the following code, that is ViewState existence form < input type = "hidden" name = "__ VIEWSTATE "value =" DDWYNDMZNDYZMJI7DDW7BDXPPDM+OZ47BDX0PDTSPG ...

Objects that can be serialized (serialized to save objects as encoded) can be stored in viewstate. General ViewState is not encrypted is BASE64 encoding, can also be configured in the Web.config encryption, the specific information can be queried.
The role of ViewState in ASP.net is to save the state of the control, the next time it is posted to the server, and the server restores the state of the control. (The state of the control includes: values and events.) )

Understanding ViewState is the process of using post to give the server, you can find some "failed to load view state" error when writing asp.net.
Error 1: After the server control is bound state, the control state Mygrid changed. EditItemIndex = 5;
Mygrid. DataSource = DT;
Mygrid. DataBind ();
Mygrid. EditItemIndex = 3;//This will cause an error.


Error 2, modifying the server control ID
The server control ID is already defined in the ASPX or Ascx page, but the new ID of the control is redefined in the CS file.

Error 3, if you really have a strange error, try adding some controls manually and try again.
WEBPART.CONTROLS.ADD (New Label ()); It is
WEBPART.CONTROLS.ADD (RIGHTDEFINE1);

Original address: http://www.cnblogs.com/king_astar/archive/2005/06/01/165763.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.