UserControl 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.

**********************************************************
//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 am interested in this issue and trying to reproduce the problem on my
side now. Is it possible for you to give me a simple testing sample and
tell me how to reproduce the problem step by step? I certainly appreciate
your time. My email address is (e-mail address removed). Please use the
following title - "19945179 - UserControl not firing".

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.
 
Hi Neil,

I have done a lot of research regarding this issue.

As I understand, the problem was because of the NullReferenceException that
caused not-firing of the oninit event.

First, I want to know whether the Base.VMenubar property was set to a valid
reference after the following line was executed:

Base.VMenubar = LoadControl("Menu/VerticalMenu.ascx");

Second, I didn't understand the next line in your code:

UltraWebListbar a = ((Menu.VerticalMenubase.VMenubar).Menu;

To my opinion, it will be very helpful if you can provide me a sample
project to demonstrate the problem step by step.

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