UserControl OnInit not firing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, All,

I'm having problems getting OnInit to fire in my
UserControl, when I use a custom template to render the
control. The control will render to the browser and it
wasn't until I needed to perform some initialization in
the OnInit event did I realize that this event was never
firing.

Two Question:
1. Why Isn't OnInit firing in the UserControl class
2. Why am I getting a NullReferenceException when I
try to assccess mMenubar after I Load the UserControl
in the Somepage class? The way I understand it is
this should Get initialized before OnInit is fired in
the UserControl Class. Obviously this isn't so!


**********************************************************
//Template class
Public Class myTemplate : Page
{
Control vMenubar;

Public Control VMenubar
{
get{Return vMenubar;}
Set{vMenubar = value;}
}

protected override void Render(HtmlTextWriter write)
{
 
Hi Neil,

Thank you for posting to the MSDN newsgroups.

I noticed that you have posted the same question in this group. I have
replied you on that thread. Please check it when you have time.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top