-Dman100-
asked on
unordered list help
I've created an user control that contains a unordered list:
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="TopMenuBar.asc x.vb" Inherits="compasslearning. TopMenuBar " TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<table border="0" cellpadding="0" cellspacing="0">
<colgroup align=left width=50% span=1></colgroup>
<colgroup align=right width=50% span=1></colgroup>
<tr>
<td>
<ul>
<asp:Repeater ID="topmenu" Runat="server">
<ItemTemplate>
<li>
<!--<%# DataBinder.Eval(Container. DataItem, "Item") %>-->
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
</td>
<td>
<form name=frmSearch method=POST action="search.asp" style="margin:0px">Search
<input type="text" size="25" name="txtQuery">
<a href="javascript:document. frmSearch. submit()"> <img src="images/go.gif" align="absmiddle" border="0"></a>
</form>
</td>
</tr>
</table>
I'm trying to control the visibility of the list in the code-behind
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim MenuItems As New ArrayList
MenuItems.Add("About Us")
MenuItems.Add("Contact Us")
MenuItems.Add("Customer Support")
MenuItems.Add("Site Map")
Dim topmenu
topmenu.Visible = False
End Sub
I'm getting the following error: Object variable or With block variable not set.
which occurs on the following line: topmenu.Visible = False
I'm going to eventually wrap this in an If statement and turn off the visibility based on a recordset value.
Thanks,
-D-
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="TopMenuBar.asc
<table border="0" cellpadding="0" cellspacing="0">
<colgroup align=left width=50% span=1></colgroup>
<colgroup align=right width=50% span=1></colgroup>
<tr>
<td>
<ul>
<asp:Repeater ID="topmenu" Runat="server">
<ItemTemplate>
<li>
<!--<%# DataBinder.Eval(Container.
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
</td>
<td>
<form name=frmSearch method=POST action="search.asp" style="margin:0px">Search
<input type="text" size="25" name="txtQuery">
<a href="javascript:document.
</form>
</td>
</tr>
</table>
I'm trying to control the visibility of the list in the code-behind
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim MenuItems As New ArrayList
MenuItems.Add("About Us")
MenuItems.Add("Contact Us")
MenuItems.Add("Customer Support")
MenuItems.Add("Site Map")
Dim topmenu
topmenu.Visible = False
End Sub
I'm getting the following error: Object variable or With block variable not set.
which occurs on the following line: topmenu.Visible = False
I'm going to eventually wrap this in an If statement and turn off the visibility based on a recordset value.
Thanks,
-D-
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm just kind of getting my feet wet with .net.
I was following your code example and think I have a basic understanding your example.
You're defining a new bulleted list
Defining the style of the bulleted list
Defining a new listItem
Creating what each list item would be --- how do you add more than one list item, just add new items seperated by semi-colons?
Add the items to the bulleted list "MyList"
Finally add the control name that can be referenced in the user control.
Am I understanding this correctly?
So, if I want to access that new control, I'd simply use:
<asp:MyList Runat="Server"></asp:MyLis t>
I hope I understand this correctly.
What are the benefits to handling the development of the list this way rather than the method I was trying? Is there an example I can find using VB.NET?
Thanks for your help.
I was following your code example and think I have a basic understanding your example.
You're defining a new bulleted list
Defining the style of the bulleted list
Defining a new listItem
Creating what each list item would be --- how do you add more than one list item, just add new items seperated by semi-colons?
Add the items to the bulleted list "MyList"
Finally add the control name that can be referenced in the user control.
Am I understanding this correctly?
So, if I want to access that new control, I'd simply use:
<asp:MyList Runat="Server"></asp:MyLis
I hope I understand this correctly.
What are the benefits to handling the development of the list this way rather than the method I was trying? Is there an example I can find using VB.NET?
Thanks for your help.
hope this 'll help
kGenius