wsyeager
Centurion
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>
<aspanel 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?
Here is my html:
<code>
<aspanel 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?