467,077 Members | 1,007 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

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

UserControl OnInit not firing

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)
{
Nov 18 '05 #1
  • viewed: 1943
Share:
1 Reply
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.

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Andy | last post: by
3 posts views Thread by | last post: by
reply views Thread by Colin Ramsay | last post: by
1 post views Thread by Patrick | last post: by
5 posts views Thread by seal | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.