Hi Stan,
Wouldn't it be easier to use the TreeView control with its style set to
Bullet List?
It would be far easier to add a node on the fly. The code below shows a
little VB sample of how it might work as a TreeView.
Let us know how you make out?
Ken
Microsoft MVP [ASP.NET]
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Button1_Click _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
Dim chnode As TreeNode
chnode = New TreeNode
chnode.Text = "Europe"
chnode.SelectAction = TreeNodeSelectAction.None
TreeView1.Nodes(0).ChildNodes.Add(chnode)
chnode = New TreeNode
chnode.Text = "Africa"
chnode.SelectAction = TreeNodeSelectAction.None
TreeView1.Nodes(0).ChildNodes.Add(chnode)
End Sub
</script>
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeView as Bulleted List</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:treeview id="TreeView1" enableclientscript="false"
runat="server" imageset="BulletedList" showexpandcollapse="False">
<parentnodestyle font-bold="False" />
<hovernodestyle font-underline="True" forecolor="#5555DD" />
<selectednodestyle font-underline="True" forecolor="#5555DD"
horizontalpadding="0px" verticalpadding="0px" />
<nodestyle font-names="Verdana" font-size="8pt"
forecolor="Black" horizontalpadding="0px" nodespacing="0px"
verticalpadding="0px" />
<nodes>
<asp:treenode selectaction="None" text="Store A"
value="Store A"></asp:treenode>
<asp:treenode selectaction="None" text="Store B"
value="Store B"></asp:treenode>
</nodes>
</asp:treeview>
<br />
<asp:button id="Button1" runat="server"
onclick="Button1_Click" text="Add Bullets" /></div>
</form>
</body>
</html>
Stan SR said:
Hi,
I need to add (dynamically) sub bulletedList to a bulletedList
Ex :
<ul>
<li>store A
<ul>
<li>Europe</li>
<li>Africa</li>
</ul>
</li>
<li>store B
<ul>
<li>Asia</li>
<li>Africa</li>
</ul>
</li>
</ul>
Here's what I wrote
the main UL is called BulletedList1
BulletedList node = new BulletedList();
node.Items.add("Europe");
BulletedList1.Items.add(node) -> it doesn't work
Any idea ?
Stan