Click here to Skip to main content
15,891,785 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to use bootstrap in asp.net combo box list box

<asp:ListBox ID="ListBox1" runat="server"  list-group-item-action"></asp:ListBox>


list-group

list-group-item-action


What I have tried:

<asp:ListBox ID="ListBox1" runat="server" class="list-group-item list-group-item-action"></asp:ListBox>
Posted
Updated 22-Aug-19 4:55am

1 solution

A Bootstrap list group[^] does not work with a <select> element, which is what the ListBox control renders.

You'll need to use a Repeater or a ListView instead.

Repeater Class (System.Web.UI.WebControls) | Microsoft Docs[^]
ListView Class (System.Web.UI.WebControls) | Microsoft Docs[^]

Eg:
ASP.NET
<asp;ListView runat="server" SelectMethod="LoadListItems">
<LayoutTemplate>
    <ul class="list-group">
        <li id="itemPlaceholder" runat="server" />
    </ul>
</LayoutTemplate>
<ItemTemplate>
    <li class="list-group-item"><%#: Eval("ItemText") %></li>
</ItemTemplate>
</asp:ListView>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900