当前位置: 代码迷 >> ASP.NET >> 为什么有些网页的AutoEventWireup指令是true,有些是false啊该怎么处理
  详细解决方案

为什么有些网页的AutoEventWireup指令是true,有些是false啊该怎么处理

热度:4820   发布时间:2013-02-25 00:00:00.0
为什么有些网页的AutoEventWireup指令是true,有些是false啊
为什么有些网页的AutoEventWireup指令是true,有些是false啊

------解决方案--------------------------------------------------------
引自:MSDN
C# code
当 AutoEventWireup 为 true 时,ASP.NET 不要求您将事件处理程序显式绑定到页事件,如 Load 。 当 AutoEventWireup 为 false 时,必须将事件显式绑定到方法。 例如,如果具有该页代码中的 Page_Load 方法,只有像如下例子所示的那样编写代码,才会在响应 Load 的事件时调用此方法。//也就说为false的时候 你要显示的绑定事件 代码如下public partial class AutoEventWireupExample : System.Web.UI.Page{     protected void Page_Load(object sender, System.EventArgs e)    {        Response.Write("Executing Page_Load");    }    override protected void OnInit(EventArgs e)    {        this.Load += new System.EventHandler(this.Page_Load);    }}
  相关解决方案