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?