Thursday, January 9, 2014

Asp.net BulletedList

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>CheckBoxTest</title>
</head>
<body>
    <form id="Form1" runat="server">
    <div>
        <asp:BulletedList ID="CountriesBulletedList" runat="server" DisplayMode="LinkButton"
            OnClick="CountriesBulletedList_Click">
            <asp:ListItem Text="Google" Value="1"></asp:ListItem>
            <asp:ListItem Text="Microsoft" Value="2"></asp:ListItem>
            <asp:ListItem Text="Dell" Value="3"></asp:ListItem>
            <asp:ListItem Text="IBM" Value="4"></asp:ListItem>
        </asp:BulletedList>
    </div>
    </form>
</body>
</html>


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public partial class DropDownlist_Default : System.Web.UI.Page
{
    protected void CountriesBulletedList_Click(object sender, BulletedListEventArgs e)
    {
        ListItem li = CountriesBulletedList.Items[e.Index];
        Response.Write("Text = " + li.Text + "<br/>");
        Response.Write("Value = " + li.Value + "<br/>");
        Response.Write("Index = " + e.Index.ToString());
    } 
}

0 comments:

Post a Comment