views:

5

answers:

0

Hi All,

This is my application setup :

I have a UserControls folder in my application inside which there is my .ascx file which happnes to contain just a simple ASP Button. I have not added any code in the code-behind of the ascx.

I have a BaseForm.cs (just a C# class file and NOT an aspx file) which is inheriting from System.Web.UI.Page

public class BaseForm : System.Web.UI.Page
    {

        protected override void OnInit(EventArgs e)
        {
            UserControls.UserButton1 ObjUserControls=(UserControls.UserButton1)LoadControl("~/UserControls/UserButton1.ascx");
            ObjUserControls.ID = "UserControl1";
            this.Form.Controls.Add(ObjUserControls);
            base.OnInit(e);
        }




    }
}

Now I will be having ASPX Pages such as : ChildPage1.aspx and ChildPage2.aspx which will be inheriting from the baseform and not from System.Web.UI.Page (obviously).

What I want to know is, how do I write a different implementation in each ChildPage for an event belonging to the UserControl. That is, for example, I want to execute ChildPage1ClickEventHandler for the Button Click event in ChildPage1.aspx and ChildPage2ClickEventHandler for the Button Click event in ChildPage2.aspx

How do I go about this ? Please help.