Manikavelu Velayutham

Manikavelu Velayutham

  • 238
  • 7.6k
  • 2.5m

AutoEventWireup Attirbute - Appropriate Usage or Scenarios ?

Dec 22 2011 5:20 AM
In which situation or in which scenario this attribute is useful in our application - AutoEventWireup ?

Just give me a real time example or if you have utilized this attribute in ur project ?

Already read the definition and explanation of this attribute in MSDN, so please dont just give the definition. 

In which scenario it really helps ?

Answers (9)

1
Pravin Ghadge

Pravin Ghadge

  • 536
  • 2.1k
  • 587.7k
Dec 22 2011 7:29 AM
Now if i run the appilcation, does the page_init, preinit will be called or not ?
Ans:Yes it will not called.

Accepted Answer
1
Manikavelu Velayutham

Manikavelu Velayutham

  • 238
  • 7.6k
  • 2.5m
Dec 22 2011 7:20 AM
For example I set the Autoeventwireup property to false.

Now if i run the appilcation, does the page_init, preinit will be called or not ?

As per your reply it should not call the above events unless you manually attach the event to the page, right ?

if so we can boycott some of the events and makes the performance better, right ?

correct me if I am wrong.
0
deepak choudhary

deepak choudhary

  • 0
  • 4
  • 0
Dec 23 2011 2:26 AM
this is the very basic thing for the pages that pages needs to process by on its controls. controls are the basic entities to navigate from one to another autoeventwireup is use to stop the invelaid callbacks for example if u r using the ddl and there is no autopostback property then if in some way there is call using java script then that time it is useful.
0
Pravin Ghadge

Pravin Ghadge

  • 536
  • 2.1k
  • 587.7k
Dec 22 2011 7:11 AM

1) For improving the performance.
 If we are working in highly traffic environment
 then it will affect performance. Because it searches for methods at run time.

2)If we set it true then framework will automatically call events. this can result in double calling of events.

I hope this will clear ur doubt.

0
Manikavelu Velayutham

Manikavelu Velayutham

  • 238
  • 7.6k
  • 2.5m
Dec 22 2011 6:59 AM
Let me change my question.

In which scenario we will set the AutoEventwireup attribute to false in C# and if so Why ?
0
Pravin Ghadge

Pravin Ghadge

  • 536
  • 2.1k
  • 587.7k
Dec 22 2011 6:44 AM
Hi,
I dont think so, it will help us to implement any functionality.
If we have set this attribute as false. Page_load,init event of Page cannot be executed.
But if we still want to execute it , we can achive this by:
<form id="form1" runat="server" OnLoad="page_load">
0
Manikavelu Velayutham

Manikavelu Velayutham

  • 238
  • 7.6k
  • 2.5m
Dec 22 2011 6:09 AM
am expecting some real time scenarios ??

Does this attribute helped you to implement any of the functionality in ur project ?
0
janaki janaki

janaki janaki

  • 0
  • 30
  • 38.7k
Dec 22 2011 5:51 AM
 hi
 it will used to fire the events automaticlly like page load event in aspx.cs page like that ,it will auto matically fires,Example button is there it will fire when we click the button only
0
Pravin Ghadge

Pravin Ghadge

  • 536
  • 2.1k
  • 587.7k
Dec 22 2011 5:48 AM
Hi,

AutoEventWireup is attribute of Page directive.

AutoEventWireup="true" is used for page event(For eg:Page load).

For eg:
If we set AutoEventWireup="false"
then Page_Load event cannot be executed.

Usage:
If we set AutoEventWireup="false"  it improves performance.