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)
{
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)
{