menu item user control

B

bill yeager

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:Hyper
Link>
</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?
 
B

bill yeager

Curt, I am trying to get an instance to the tablecells
already with the following code inside the code-behind
file to the user control as follows:

Dim tcAdmin As TableCell = DirectCast
 

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,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top