If you are asp.net developer then may be you know this term -"AutoEventWireUp"
I would like to write about this because many developers don't know about it as it will be added automatically when you create any page in asp.net.
But it is basic fundamental thing every developer should know about it!
If you ask question yourself why all page_event will be call automatically?
then "AutoEventWireUp" can give you answer about that.
As per msdn link
"If the AutoEventWireup attribute of the @ Page directive is set to true, page events are automatically bound to methods that use the naming convention of Page_event, such as Page_Load and Page_Init."
1) By default It is true
2) If you make It false then page_event will not call automatically
for that you need handled that event explicitly
protected override void OnInit(EventArgs e)
{
this.Load += Page_Load;
}
To know more about it look ASP.NET Web Server Control Event Model
No comments:
Post a Comment