Dindar
Dindar

Reputation: 3245

what does base.OnPreInit(e) mean?

Any one could simply tell me what does base.OnPreInit(e) mean ?

Thank you

Upvotes: 2

Views: 2657

Answers (3)

Jeff
Jeff

Reputation: 2871

base.OnPreInit(e) is a call to the OnPreInit() method of the base class for the page you are looking at.

'e' is the parameter that was passed in to your method (presumably OnPreInit() ) and it is passed through to the base class's method.

Upvotes: 1

Oleks
Oleks

Reputation: 32333

When overriding methods e.g. OnPreInit in your example sometimes it is necessary to call the control/page base method, for this purposes you could just use base.OnPreInit(e) which will call the base class method.

Upvotes: 2

Bala R
Bala R

Reputation: 108957

The OnPreInit method is called at the beginning of the page initialization stage.

When you are overriding this in your page, you'll have something like

protected override void OnPreInit(EventArgs e)
{
   base.OnPreInit(e);
   ...
   // do something else 

}

where base.OnPreInit(e) calls the Page class's OnPreInit(). If you don't have extra functionality to add to your page then you don't have to override OnPreInit

Upvotes: 7

Related Questions