- BulletedList Web Server Control
The BulletedList Web server control can be used create ordered(numbered) or unordered lists of items, which render as HTML ul or ol elements, respectively. To specify the individual items in the list, place a ListItem control for each list entry between the opening and closing tags of the BulletedList control.
Set Item Display Mode
The BulletedList control can display list items as any of the following:
- Static text -The text displayed by the control is not interactive.
- HyperLink controls-Users can click links to navigate to another page.
- LinkButton controls - Users can click individual items and the control performs a postback.
Set List Item Styles
you can select from predefined bullet styles, such as:
Adding List Item
You can add items to a list Web server control in these ways:
- Add static items at design time.
- Add items programmatically at run time.
- to add static items at design time
you simply include the folloing codes in your web page:
-
<asp:ListBox ID="ListBox1" runat="server">
<asp:ListItem Text="Red" Value="#FF0000" Selected="True" />
<asp:ListItem Text="Blue" Value="#0000FF" />
<asp:ListItem Text="Green" Value="#008000" />
</asp:ListBox><br />
-
- to Add items programmatically at run time.
you simply include the folloing codes in your code page:
-
Protected void Button1_Click (object sender, System.EventArgs e)
{
ListBox1.Items.Add(new ListItem("Carbon", "C"));
ListBox1.Items.Add(new ListItem("Oxygen", "O"));
}
- Related Links
-
96211736-ed81-4c3c-970c-46e100adfb85|0|.0
23bc07eb-af71-4fa9-8da9-d92e1ae7b3bf|0|.0