A ChildClass user control I’m working with has a chain of parent classes, ultimately inheriting from System.Web.UI.UserControl.
public BasestClass : AnotherClassExtendingUserControl
{
private void Page_Load(object sender, EventArgs e)
{
// do some stuff
}
}
public BaseClass : BasestClass
{
// no Page_Load
}
Two parent classes up the chain, Page_Load is marked private. The ‘middle’ class obviously doesn’t override it, but I need to add something to the Page_Load of the ChildClass user control.
public ChildClass : BaseClass
{
// think I need to override Page_Load here,
// but there is no acceptable method to override
}
What can I do to get into the Page_Load of ChildClass? There are controls in that control that I need to manipulate that do not exist in BaseClass or BasestClass.
The
Page_Load(orLoad) event gets raised during execution of theOnLoadevent method, so I would suggest moving your logic there. You shouldn’t have a problem overriding theOnLoadmethod from your child class.