The inherit of WebForm

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I have a webform call MyWebPage, which is inherited from a Base web page
call BaseWebPage.

There is a Page_load event in the BaseWebForm.

Need it add a Page_Load event like below in the MyWebPage for calling the
Page_Load event in the BaseWebForm.




new void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
}
 
ad said:
I have a webform call MyWebPage, which is inherited from a Base web page
call BaseWebPage.

There is a Page_load event in the BaseWebForm.

Need it add a Page_Load event like below in the MyWebPage for calling the
Page_Load event in the BaseWebForm.




new void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
}

Page_Load is an event, not a method. What you are probably looking for is
an event named OnPageLoad, or OnLoad or similar method that you can
override.

HTH,
Mythran
 
You can have the base subscribe the event as well as the implementor ..

in the base's constructor you can say ...

this.OnLoad += new eventhandler(this.BasePageLoad);

another option would be to make the handler in the base virtual and then
override it in the deriving class.

Cheers,

Greg

this
 

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

Back
Top