asp.net.ph

Skip Navigation Links

Adding BulletedList Items Programmatically

Controls You Can Use on Web Forms   ASP.NET Standard Controls   BulletedList Control


The BulletedList control exposes an Items collection, which comprise the root BulletedListItem objects defined for the control.

Root bulletedlist items can be configured programmatically, by creating new instances of the BulletedListItem class and adding them to the Items collection in the order that they will appear in the bulletedlist structure.

BulletedListItem newItem = new BulletedListItem ( bulletedlistitemText, bulletedlistItemValue );
newItem.NavigateUrl = webPageUrl;
bulletedlistObject.Items.Add ( newItem );

In the same manner, each BulletedListItem object exposes a ChildItems collection, which comprise the child BulletedListItem objects, if any, defined for that particular bulletedlist item.

Likewise, child bulletedlist items can be configured programmatically, by creating new instances of the BulletedListItem class and adding them to the ChildItems collection of the parent node, in the order that they will appear in the bulletedlist structure.

BulletedListItem newItem = new BulletedListItem ( bulletedlistitemText, bulletedlistItemValue );
newItem.NavigateUrl = webPageUrl;
parentBulletedListItemObject.ChildItems.Add ( newItem );

The following example demonstrates how to populate the contents of a BulletedList control dynamically. Note that while a BulletedList control cannot be directly bound to a non-hierarchical data source, such as a database table, it can be made to display the contents of a database table using the above concepts.

 Show me 

See Also

Binding a BulletedList Control to a Data Source   Customizing the BulletedList Control Interface



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note