asp.net viewstate-see ViewState again.

Source: Internet
Author: User

Order

Html

<%@ Page language= "C #" autoeventwireup= "true" codefile= "Default.aspx.cs" inherits= "_default"%> <!
DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

Cs

Using System;
Using System.Data;
Using System.Configuration;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
public partial class _default:system.web.ui.page
{
protected void Page_Init (object sender, EventArgs e) 
  
    {
DdlTest.Items.Add (new ListItem ("Init", "Init"));
}
protected void Page_Load (object sender, EventArgs e)
{
ddlTest.Items.Add (new ListItem ("Load", "Lo  Ad "));
}
}  
  

Recently saw a friend said Page_Init only to execute once, I always doubt, so I test it, the results found that every time you click the button will not really add init such list items. Is it true that Page_Init is only executed once? Fantasy is not the solution, a breakpoint tracking, found that every time the init will be executed, this situation is not related to init (she is innocent). Who is the real "Black Hand" behind the scenes?

Related Article

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.