473,386 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Auto Event wireup

366 256MB
Hello

can any body please give exact for AutoEventwireup=true;

AutoEventwireup=false;

by default it is false in which we hav to make it as true what is the exact use of

this

Please dont send any msdn web link and other web site links


thanks and regards

nmsreddi
Jan 17 '07 #1
3 4568
radcaesar
759 Expert 512MB
When we create a new ASP.NET Web Application in Visual Studio .NET, by default, the value of the AutoEventWireup attribute is set to false in the .aspx page and event handlers are automatically created. We can find this in the InitializeComponent method:

this.Load += new System.EventHandler(this.Page_Load);

The best way to see the working of this attribute would be:

* Declare a string variable msg as public in WebForm1.aspx.cs.
* In the HTML section of WebForm1.aspx, enter the following code in the <Head> section:

<% Response.Write(msg); %>

In the Page_Load, you could enter a value for the variable msg declared.

msg= "We are in Page_Load()";

On running the application, you will get the message We are in Page_Load() [hereafter referred to as message]. Note: this is in the default case where the attribute is set to false.

Now try commenting the event handler code for the Page_Load in the aspx.cs file; and set the AutoEventWireup attribute to false in the .aspx page. On running the application this time, you will not get the message.

Now with the event handler code for the Page_Load in the aspx.cs file still commented; set the AutoEventWireup attribute to true in the .aspx page. On running the application this time, you will get the message.

Reason: In the case where AutoEventWireup attribute is set to false (by default), event handlers are automatically required for Page_Load or Page_Init. However, when we set the value of the AutoEventWireup attribute to true, the ASP.NET runtime does not require events to specify event handlers like Page_Load or Page_Init.

Source: Code Project

:)


Hello

can any body please give exact for AutoEventwireup=true;

AutoEventwireup=false;

by default it is false in which we hav to make it as true what is the exact use of

this

Please dont send any msdn web link and other web site links


thanks and regards

nmsreddi
Jan 17 '07 #2
nmsreddi
366 256MB
thanks mr RAD

you have given some good stuff

can you say some situations when it is needed to be true ,any drawbacks with

that default value autoeventwireup=false;
Jan 18 '07 #3
When we create a new ASP.NET Web Application in Visual Studio .NET, by default, the value of the AutoEventWireup attribute is set to false in the .aspx page and event handlers are automatically created. We can find this in the InitializeComponent method:

this.Load += new System.EventHandler(this.Page_Load);

The best way to see the working of this attribute would be:

* Declare a string variable msg as public in WebForm1.aspx.cs.
* In the HTML section of WebForm1.aspx, enter the following code in the <Head> section:

<% Response.Write(msg); %>

In the Page_Load, you could enter a value for the variable msg declared.

msg= "We are in Page_Load()";

On running the application, you will get the message We are in Page_Load() [hereafter referred to as message]. Note: this is in the default case where the attribute is set to false.

Now try commenting the event handler code for the Page_Load in the aspx.cs file; and set the AutoEventWireup attribute to false in the .aspx page. On running the application this time, you will not get the message.

Now with the event handler code for the Page_Load in the aspx.cs file still commented; set the AutoEventWireup attribute to true in the .aspx page. On running the application this time, you will get the message.

Reason: In the case where AutoEventWireup attribute is set to false (by default), event handlers are automatically required for Page_Load or Page_Init. However, when we set the value of the AutoEventWireup attribute to true, the ASP.NET runtime does not require events to specify event handlers like Page_Load or Page_Init.

Source: Code Project

:)

Great Thanks To You.
I know detail because of you.
is that only for Page Events ?

regards,
<X>
Jan 18 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Brian | last post by:
I am so happy to have mastered the technique for "Press Tab to insert". I type " += " and up steps Visual Studio to write my event handler for me. This is more fun than Intellisense. But I...
7
by: Oisin Grehan | last post by:
Hi, I have a UserControl derived class: <ns:votingbutton runat="server" id="btn1" onclick="votingbuttonclick" /> My question is, what code do I need in place in the codebehind for this to...
1
by: Roger | last post by:
My page_load event doesn't fire if I close my browser and reopen it to the same page. Any reason why? Is there something I need to set in my web.config or global.asax? Right now, I don't have...
3
by: localhost | last post by:
In my ASP.NET page code-behind, I have added a textbox like this: (C#) System.Web.UI.HtmlControls.HtmlGenericControl div1= new HtmlGenericControl( "div" ); div1.ID = "divNewTextBox";...
1
by: Dave | last post by:
If I want to have the form submit when a user clicks on table cell as follows on a menu something like.. <td style="cursor:hand;" onmouseover="this.style.backgroundColor='white'"...
5
by: Samuel | last post by:
Hi, I am running into a problem of mixing UICulture = auto and allowing users to select culture using a dropdown list. I am detecting a querystring, "setlang", and when found, setting the...
3
by: csgraham74 | last post by:
Hello, Ive been working on an asp.net application in both dreamweaver and visual studio .Net. Ive imported files created in dreamweaver into my VS.Net application. The main problem that i...
6
by: Joseph Geretz | last post by:
I'm porting a C# Outlook Addin originally engineered as a COM Addin over to use VSTO. I've gotten this to the point where my VSTO Addin installs its Menu items and Toolbar buttons when Outlook...
6
by: Mark Chambers | last post by:
Hi there, Does anyone know why the "ColumnChanged" event isn't fired when "Merge()" is called below. "OnRowChanged()" is fired however: Thanks in advance. private static void Test() {...
5
by: Andrew Robinson | last post by:
I have a page that can load a number of different user controls. Each of these user controls inherits from a common base class and the controls are loaded based on application state, status, etc...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.