Empty asp:BulletedList doesn't show up in html

560 views Asked by At

I'm trying to add an empty asp:BulletedList to a page so I can run a jquery on it. But when I open the page the bulletlist doesn't show up.

Is there a trick to getting an empty asp:BulletedList to show up?

1

There are 1 answers

1
Yuriy Galanter On BEST ANSWER

Empty BulletedList like this:

<asp:BulletedList ID="BulletedList1" runat="server">
</asp:BulletedList>

will not render into page HTML at all because it makes no sense much as <UL> element without <LI> elements.

But if you add at least one (even empty) list item:

<asp:BulletedList ID="BulletedList1" runat="server">
     <asp:ListItem></asp:ListItem>
</asp:BulletedList>

It will render as

<ul id="BulletedList1">
   <li></li>
</ul>