Exposing properties of a user control to the web forms page

J

Jason

http://msdn.microsoft.com/library/d...l/vbwlkwalkthroughcreatingwebusercontrols.asp

Following the above example I created a usercontrol and added it to another
web form MyPage.aspx. Then I added code to declare the user control as
instructed in the above article:

' Visual Basic menu as a user control
Public Class MyPage
Inherits System.Web.UI.Page
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected Menu1 As menu

But if I try to make a call to menu1 (menu1.itemname = "test") it screams at
me that the object has not been created and is still "nothing". When/how
does the user control object (menu1) get created. What step am I missing
here.

Thanks in advance,

Jason
 
C

Chris Jackson

Are you putting your code in the OnLoad event handler? You can't access this
control until it has completed loading.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top