The AutoEventWireUp value may have the value of true or false
We can specify the default value of the AutoEventWireup in the following locations
=>machine.config
=>web.config
=>Individual webforms
=>WebUser Controls
Web.config
<Configuration>
<system.web>
<pages autoEventWireUp=true/>
</system.web>
</configuration>
If you make this changes in web.config file ,it will effect to all ASP.NET webforms.But this we can ovverride in each ASP.NET page.
EX:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string msg = "Auto Event Wire Up Executed";
lblAutoEventWireUp.Text = msg;
}
protected override void OnInit(EventArgs e)
{
this.Load += new System.EventHandler(this.Page_Load);
}
}
If autoEventWireUp event false then it will not execute page load, we need to explicitly call the page_load in OnInit Event like above.
We can specify the default value of the AutoEventWireup in the following locations
=>machine.config
=>web.config
=>Individual webforms
=>WebUser Controls
Web.config
<Configuration>
<system.web>
<pages autoEventWireUp=true/>
</system.web>
</configuration>
If you make this changes in web.config file ,it will effect to all ASP.NET webforms.But this we can ovverride in each ASP.NET page.
EX:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string msg = "Auto Event Wire Up Executed";
lblAutoEventWireUp.Text = msg;
}
protected override void OnInit(EventArgs e)
{
this.Load += new System.EventHandler(this.Page_Load);
}
}
If autoEventWireUp event false then it will not execute page load, we need to explicitly call the page_load in OnInit Event like above.
0 comments:
Post a Comment