There are several list controls available to ASP.NET. They are the DropDownList, ListBox, CheckBoxList, RadioButtonList and BulletedList controls. The one I will go over in this post is the BulletedList control.
The ASP.NET BulletedList control is used to create a defined list of items formated with bullets. Each item in a BulletedList control is considered a ListItem element. This control can be loaded manually through ASP.NET code (like my example) as well as from a data source.
The BulletedList control is part of the System.Web.UI.WebControls namespace.
–
Most common properties
DisplayMode
Gets or sets the display mode of the list content in a BulletedList control
BulletStyle
Gets or sets the bullet style for the BulletedList control
BackColor/ForeColor
Gets or sets the back/foreground color of the web server control
Border Color/Style/Width
Gets or sets the border color/style/width of the web server control
Font
Gets the font properties associated with the web server control
-
The BulletedList control has three display types:
- Hyperlink
- LinkButton
- Text
-
The following BulletStyles are available for the BulletedList control:
- Circle – Hollow Circle
- Disc – most common Bullet
- LowerAlpha – Letters
- LowerRoman – Roman Numerals
- Numbered
- Square
- UpperAlpha – Letters
- UpperRoman – Roman Numerals
- CustomImage
-
Simple Example of the BulletedList Control
This example fills the control to display.
ASP.NET SOURCE
Below are the current planets in our Solar System.<br />
<asp:BulletedList ID=blPlanets BulletStyle="Square" runat=server>
<asp:ListItem>Mercury</asp:ListItem>
<asp:ListItem>Venus</asp:ListItem>
<asp:ListItem>Earth</asp:ListItem>
<asp:ListItem>Mars</asp:ListItem>
<asp:ListItem>Jupiter</asp:ListItem>
<asp:ListItem>Saturn</asp:ListItem>
<asp:ListItem>Uranus</asp:ListItem>
<asp:ListItem>Neptune</asp:ListItem>
</asp:BulletedList>
C# SOURCE
You can also fill the BulletedList control dynamically using the Page load event instead of ASP.NET code.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
blPlanets.Items.Add("Mercury");
blPlanets.Items.Add("Venus");
blPlanets.Items.Add("Earth");
blPlanets.Items.Add("Mars");
blPlanets.Items.Add("Jupiter");
blPlanets.Items.Add("Saturn");
blPlanets.Items.Add("Uranus");
blPlanets.Items.Add("Neptune");
}
}
RESULT

-
This post concludes my List Control series. There are many other methods of implementing the different List Controls in ASP.NET. I have barely scratched the surface of possibilities.
-
[- Related Links -]
ASP.NET Quickstart Tutorials – BulletedList
ASP.NET Tutorial – BulletedList