467,211 Members | 1,210 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,211 developers. It's quick & easy.

Timing issues with OnInit in derived class

I've got a asp.net page that is derived off a custom class. The base
class does some init stuff in OnInit that is needed by the derived
pages. I'm having a timing problem with OnInit. The OnInit in the
derived classes executes BEFORE the OnInit in the base class. I need
it to be the other way around. How can I fix this?

Nov 19 '05 #1
  • viewed: 986
Share:
1 Reply
> I've got a asp.net page that is derived off a custom class. The base
class does some init stuff in OnInit that is needed by the derived
pages. I'm having a timing problem with OnInit. The OnInit in the
derived classes executes BEFORE the OnInit in the base class. I need
it to be the other way around. How can I fix this?


In your derived class' OnInit, call base.OnInit prior to doing the work that
replies upon the base's implementation.

// base.cs

override void OnInit(EventArgs e)
{
base.OnInit(e);

// Your stuff here....
}

-Brock
http://staff.develop.com/ballen


Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Stuart McGraw | last post: by
1 post views Thread by | last post: by
3 posts views Thread by Raymond Du | last post: by
1 post views Thread by sj985 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.