Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm trying to create a user control which will act as a menu list for users to click on. All the user control consists of is a panel, a table within the panel, 1 tablerow and multiple table cells for a horizontal look. However, the tablecells inside the usercontrol cannot be found ("Object not set to an instance of an object"). If I implement the same code within the page itself, without the usercontrol, it works fine.

 

Here is my html:

<code>

<asp:Panel Runat="server" id="Panel1" style="Z-INDEX: 108; LEFT: 8px; POSITION: absolute; TOP: 48px">

<asp:table id="Table2" runat="server" Font-Bold="True" Font-Size="X-Small">

<asp:TableRow Visible="False" ID="trMain">

<asp:TableCell Visible="False" ID="tcAdmin">

<asp:HyperLink runat="server" NavigateUrl="../Admin/Admin.aspx">Administration</asp:HyperLink>

</asp:TableCell>

.

.

.

</code>

 

Here is my code behind in the user control:

<code>

Public Sub LoadMenu()

 

Try

Dim blnFound As Boolean

Dim tcAdmin As TableCell = DirectCast(FindControl("tcAdmin"), TableCell)

</code>

 

Here is my code in the code behind for the parent aspx page:

<code>

Protected MenuItems As New RMS2.MenuItems

.

.

.

MenuItems.LoadMenu()

</code>

 

When debugging inside the usercontrol, the tcAdmin variable has a value of Nothing.

 

How can I get this variable inside the user control to be recognized?

Thanks,

 

Bill Yeager (MCP, BCIP)

Microsoft Certified Professional

Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer

YeagerTech Consulting, Inc.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...