Effects of keeping AutoEventWireup "true" or "false"


When AutoEventWireup is true,  .Net automatically associates page events and methods to event handlers as per event name. i.e. For Load and Init event, Page_Load and Page_Init handler is considered, respectively. No explicit Handles clause or delegare is needed.

When you set AutoEventWireup="false",  you have to add an event handler for your page event.

Below code helps you understand everything about it.

namespace AutoEventWireUpCheck
{
    public partial class _Default : System.Web.UI.Page
    {
        public _Default()
        {
            this.Load += new EventHandler(_Default_MyPageLoad);
        }

        protected void _Default_MyPageLoad(object sender, EventArgs e)
        {
            //Do anything
            int i = 0;
            System.Console.WriteLine("From _Default_Load event");
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            //Do anything
            int i = 0;
            System.Console.WriteLine("From page load event");
        }
    }
}

This will call _Default_MyPageLoad event on page load. (Page_Load will not be called)
Here, keeping AutoEventWireup="false" and not defining event handler for Load event will not call any event handler though you’ve written Page_Load event.

keeping AutoEventWireup="true" will call Page_Load event.
If you keep
(1) AutoEventWireup="true",
(2)
public _Default()
{
this.Load += new EventHandler(_Default_MyPageLoad);
}
 Code and
(3)
define both event handler, both event handler will be called.

Posted in | 0 comments

The Installer was interrupted before Setup could be installed. You need to restart the installer to try again. Click Close to Exit

Hello Friend’s
Before two years I have faced problem during Installation of web application which was build from Microsoft Visual Studio 2010.The Problem was “The Installer was interrupted before Setup could be installed. You need to restart the installer to try again. Click Close to Exit”.And today my collages face same problem.I thought to write on my blog so other can get solution from here.



In Windows 7+, Widnows Server 2008+ Systems have a Compatibility issue with IIS metabase.  To solve this issue follow below steps. My environment is windows 7.
è Go to Control Panel -> Programs and Features sections.
è Click on Turn Windows features on or off.
è Expan IIS-> Web Management Tools -> IIS Management Compatibility -> and check mark on IIS Metabase and IIS Configuration compatibility.




Let me know your feedback.



Posted in | 12 comments