problem registering events in class heirarchies in asp.net

E

enantiomer

I am using visual studio.net to do my work and I have a base page
class that my other page classes derive from. the base class has on
OnInit method in order to register the InitializeComponent method
which is where vis stud automatically adds event handlers for the
various objects in the asp.net page. My problem is in a class that
derives my base class, i dont know where to add my event handlers for
the new objects of the page. I can't override OnInit again... how do
you deal with this kind of situation?
Thanks,
Jon

public class BasePage: Page
{
..
..
..
protected override void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
}

public class secondPage: BasePage
{
protected System.Web.UI.WebControls.Button myButton;
********where do i add the button to the even handler?*************
..
..
..
}
 
A

Abhijeet Dev

why cant override OnInit again? in the overridden OnInit, just add
base.OnInit()

Abhijeet Dev
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top