<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="BulletedListTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>BulletedList Test</title>
</head>
<body>
<form id="form1" runat="server">
<div id="container">
<h1>BulletedList Demo</h1>
Choose a display mode:
<asp:DropDownList ID="drpDisplayMode"
runat="server"
OnSelectedIndexChanged="drpDisplayMode_SelectedIndexChanged"
AutoPostBack="True">
<asp:ListItem Selected="True">Text</asp:ListItem>
<asp:ListItem>HyperLink</asp:ListItem>
<asp:ListItem>LinkButton</asp:ListItem>
</asp:DropDownList>
<asp:BulletedList ID="blUrls" runat="server" DisplayMode="Text"
BulletStyle="Square" OnClick="blItems_Click">
<asp:ListItem Value="http://www.microsoft.com">Microsoft</asp:ListItem>
<asp:ListItem Value="http://www.adobe.com">Adobe</asp:ListItem>
<asp:ListItem Value="http://www.oracle.com">Oracle</asp:ListItem>
</asp:BulletedList>
<asp:Label ID="labMsg" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
File: Default.aspx.cs
using System;
using System.Data;
using System.Drawing;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class BulletedListTest : System.Web.UI.Page
{
protected void blItems_Click(object sender, BulletedListEventArgs e)
{
labMsg.Text = "The bullet item index you selected was " + e.Index;
}
protected void drpDisplayMode_SelectedIndexChanged(object sender, EventArgs e)
{
string sMode = drpDisplayMode.SelectedItem.Text;
BulletedListDisplayMode mode;
mode = (BulletedListDisplayMode)Enum.Parse(typeof(BulletedListDisplayMode), sMode, true);
blUrls.DisplayMode = mode;
}
}