How to use BulletedList display mode as LinkButton in asp.net

BulletedList DisplayMode LinkButton
BulletedList is an asp.net list web server control. BulletedList server control render a list of items in a bulleted format in web browser. BulletedList DisplayMode property get or set the display mode of the list content in a BulletedList control.

BulletedListDisplayMode enumeration have three possible values those are Text, LinkButton and HyperLink. Bulletedlist control is configured to display individual items as LinkButton controls by setting the DisplayMode property value to LinkButton. LinkButton display mode allow us to display list item content as link button. We can use BulletedList Click event to post back to the server when the user clicks a link button. asp.net developers can use the BulletedListEventArgs class event data to determine the index of the link button in a BulletedList that user clicked.

BulletedList Click event occurs when user clicked a link button. To enable BulletedList control to raise Click event, first we need to set the DisplayMode property value to LinkButton. Next we can write an event handler for the click event.

The following c# example code demonstrate us how can we use BulletedList DisplayMode as LinkButton in asp.net.
BulletedListDisplayModeLinkButton.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void BulletedList1_Click(object sender, System.Web.UI.WebControls.BulletedListEventArgs e)
    {
        Label1.Text = "You Choose: " + BulletedList1.Items[e.Index].Text;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to use BulletedList display mode (DisplayMode) as LinkButton</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">BulletedList: DisplayMode LinkButton</h2>
        <asp:Label 
             ID="Label1"
             runat="server"
             Font-Bold="true"
             ForeColor="Crimson"
             Font-Size="Large"
             >
        </asp:Label>
        <br /><br />
        <asp:Label 
             ID="Label2"
             runat="server"
             Font-Bold="true"
             ForeColor="DodgerBlue"
             Text="asp.net controls"
             >
        </asp:Label>
        <asp:BulletedList 
             ID="BulletedList1"
             runat="server"
             Width="275"
             BorderColor="DarkBlue"
             BorderWidth="2"
             DisplayMode="LinkButton"
             OnClick="BulletedList1_Click"
             >
             <asp:ListItem>ListView</asp:ListItem>
             <asp:ListItem>FormView</asp:ListItem>
             <asp:ListItem>LinqDataSource</asp:ListItem>
             <asp:ListItem>XmlDataSource</asp:ListItem>
             <asp:ListItem>RegularExpressionValidator</asp:ListItem>
        </asp:BulletedList>
    </div>
    </form>
</body>
</html>
More asp.net examples