UserControl not firing

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

Jacob Yang [MSFT]

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

Jacob Yang [MSFT]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top