What Are The Difference Between AutoEventWireup="true" and
AutoEventWireup="False"

Answers were Sorted based on User's Feedback



What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False&q..

Answer / vishnu prasad.c

When you set the value of the AutoEventWireup attribute to
false, you must manually hook up events to event handlers.

When you set the value of the AutoEventWireup attribute to
true, the ASP.NET page framework can automatically raise
events.

Is This Answer Correct ?    39 Yes 5 No

What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False&q..

Answer / uma

Dont read all the those things simply understand

actually AutoEventWireup is written in page directive like
this

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default2.aspx.cs" Inherits="Default2" %>

by default it is "true", that means all the events that are
automatically rises when page is loading


if AutoeventWireUp=false then we have to manually write
events and delegates like this




public _Default() // ctor
{
Load += new EventHandler(Page_Load);
PreInit += new EventHandler(Page_PreInit);
}

protected void Page_Load(object sender, EventArgs e)
{
// ...
}

protected void Page_PreInit(object sender, EventArgs e)
{
// ...
}

Is This Answer Correct ?    20 Yes 1 No

What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False&q..

Answer / navneet

When you set the value of the AutoEventWireup attribute to
false, you must manually hook up events to event handlers.
such as Page_Load() etc.

When you set the value of the AutoEventWireup attribute to
true, the ASP.NET page framework can automatically raise
events.
such as Page_Load() etc.

Is This Answer Correct ?    21 Yes 3 No

What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False&q..

Answer / vinodh reddy

The default value for AutoEventWireup is true for a C# web
form, and false for a VB.NET web form. The IDE adds the
default values to the @ Page directive for a new web form.
The difference in defaults is partly because VB.NET has a
mechanism for defining an event handler and subscribing to
an event in one graceful motion (the Handles keyword).


Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Me.Load
' ...

End Sub


An easy way to generate the above code is to use the drop
down controls that sit just above the editor. Note: C#
doesn t make the dropdown list of events available when
editing a code-beside file, but the dropdown is available
when writing in-line code.

There is no equivalent to the Handles keyword in C#
(anonymous event handlers are arguably close, but just not
the same). When AutoEventWireup is true, all we need to do
is follow the method naming convention of
Page_EventToHandle. The ASP.NET runtime will automatically
find and fire the method for the appropriate event.


protected void Page_Load(object sender, EventArgs e)
{

}


Once Again, In Reverse
If we switch to AutoEventWireup= true for a VB.NET web
form, we can use the magic Page_EventName approach. The
only change to the earlier VB.NET code would be to drop the
Handles clause, and the events fire correctly.

If we switch to AutoEventWireup= false for a C# web form,
there is a little extra work to do. Somewhere we need to
explicitly wire up events. Here is one approach.


public partial class _Default : Page
{
public _Default() // ctor
{
Load += new EventHandler(Page_Load);
PreInit += new EventHandler(Page_PreInit);
}

protected void Page_Load(object sender, EventArgs e)
{
// ...
}

protected void Page_PreInit(object sender, EventArgs e)
{
// ...
}
}

Is This Answer Correct ?    17 Yes 3 No

What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False&q..

Answer / kapil sharma

Dont be too confuse in this question for understand

actually AutoEventWireup is written in page directive like
this

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default2.aspx.cs" Inherits="Default2" %>

by default it is "true", that means all the events that are
automatically rises when page is loading


if AutoeventWireUp=false then we have to manually write
events and delegates like this




public _Default() // ctor
{
Load += new EventHandler(Page_Load);
PreInit += new EventHandler(Page_PreInit);
}

protected void Page_Load(object sender, EventArgs e)
{
// ...
}

protected void Page_PreInit(object sender, EventArgs e)
{
// ...
}
So by default its means all event automatically wire up
when page load and if its false we have do some extra
work....

Is This Answer Correct ?    4 Yes 0 No

What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False&q..

Answer / anil jadhav

here is the proper valid answer
AutoEventWireup attribute
AutoEventWireup is a Boolean attribute that indicates
whether events of a Web Forms page are autowired.The default
value for AutoEventWireup is TRUE.

In Visual Basic .NET or in Visual Basic 2005, the designer
performs this binding using the Handles keyword in the
declaration of the event-handler method.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load

The ASP.NET page framework supports an alternative mechanism
that uses the AutoEventWireup attribute of a Web Forms page
to automatically associate page events and event-handler
methods. If the AutoEventWireup attribute of the @ Page
directive is set to TRUE (or if it is not specified because
its default value is TRUE), the ASP.NET page framework
automatically calls page event-handler methods.

For example, the Page_Init and Page_Load event-handler
methods are explicitly called by the ASP.NET page framework,
without using the Handles keyword or an explicit event delegate.

Conclusion
When you explicitly set AutoEventWireup to TRUE, Visual
Studio .NET or Visual Studio 2005, by default, generates
code to bind events to their event-handler methods. At the
same time, the ASP.NET page framework automatically calls
the event-handler methods based on their predefined names.

Is This Answer Correct ?    5 Yes 2 No

What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False&q..

Answer / firoz khan

if the AutoEventWireup="true" than the event of page load automatic genreate
else
genreated by hendler or created him self if u can 

Is This Answer Correct ?    1 Yes 0 No

What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False&q..

Answer / karthees

AutoEventWireup= true:-)
When value of the AutoEventWireup attribute is set to true, the ASP.NET page framework can automatically raise events.

AutoEventWireup= false:-)
When value of the AutoEventWireup attribute is set to false, one must manually call the events to event handlers.

Is This Answer Correct ?    1 Yes 1 No

What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False&q..

Answer / meganadha reddy k.

I guess what you mean is AutoPostBack="true" in which the
index change of a drop down box will be posted back to
server.
Please correct me if I am wrong.

To know the difference between autoEventWireup="true" and
autoEventWireup="false" please refer the below link:

http://support.microsoft.com/kb/324151

Regards,
Meganadha Reddy K.

Is This Answer Correct ?    6 Yes 8 No

What Are The Difference Between AutoEventWireup="true" and AutoEventWireup="False&q..

Answer / ruchika garg

First of all the above answer that default value for auto
eventwireup=true is false bcoz the default value of
autoeventwireup=false in c#

A false value indicates that you must explicitly write a
code to bind events related to a page ,such as the load
event of a page

and true value indicates that events will be generated
automatically

Is This Answer Correct ?    1 Yes 9 No

Post New Answer

More ASP.NET Interview Questions

What is difference between Fragment Caching and Page Caching in ASP.NET?

0 Answers   PUCIT,


What is autopostback in asp net?

0 Answers  


How can we prepairing Interview

0 Answers   ITcom, TCS,


What kind of programming language is ASP.NET?

0 Answers   3i Infotech,


Which is the best institute to learn Microsoft Technologies and the faculty if you Know?

0 Answers   TCS,






What is difference between view state and session state?

0 Answers  


How do you store a value in viewstate and retrieve them?

0 Answers  


What is operator overloading in dotnet

1 Answers  


What is the difference between and ActiveX dll and control?

2 Answers   Microsoft,


Describe the .net base class library.

0 Answers  


Your ASP.NET application displays sales data on a page. You want to improve performance by holding the page in memory on the server for one hour. You want to ensure that the page is flushed from memory after one hour, and that the page is re-created when the next request for the page is received. What should you do? A . Initialize a new instance of the Cache class in the Application.Start event handler. B . Initialize a new instance of the Timer class in the Page.Load event handler. C . Set the Duration attribute of the OutputCache directive in the page. D . In the Web.config file, set the timeout attribute of the sessionState element.

5 Answers   ADITI, Syntax Softtech,


Differentiate the session object and application object?

0 Answers  


Categories