'BulletedList'에 해당되는 글 1건

  1. 2007.03.07 ASP.NET BulletedList 컨트롤 사용 예제
posted by 써니루루 2007. 3. 7. 16:24

참조 : 뇌를 자극하는 ASP.NET p 211

HTML의 List를 출력하는 UL, LI 테그등으로 랜더링 되는 테그들입니다.
3번째 불릿티드 리스트에는 클릭이벤트의 처리를 했습니다.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="p221.aspx.cs" Inherits="p221" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>BulletedList</title>
    <script runat="server">
        protected void BulletedList3_Click(object sender, BulletedListEventArgs e)
        {
            Response.Write("선택한 목록 번호 : " + e.Index.ToString()
                + "<br />선택한 목록 Value : "
                + BulletedList3.Items[e.Index].Value
                + "<br />선택한 목록 Text : "
                + BulletedList3.Items[e.Index].Text
            );
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table style="width: 583px">
            <tr>
           
            <td>
            <h3>Disc</h3>
            <asp:BulletedList ID="BulletedList1" runat="server">
                <asp:ListItem>Item #1</asp:ListItem>
                <asp:ListItem>Item #2</asp:ListItem>
                <asp:ListItem>Item #3</asp:ListItem>
                <asp:ListItem>Item #4</asp:ListItem>
            </asp:BulletedList>
            </td>
           
            <td>
            <h3>Circle</h3>
            <asp:BulletedList ID="BulletedList2" BulletStyle="Circle" DisplayMode="HyperLink" runat="server">
                <asp:ListItem Value="http://daum.net">Item #1</asp:ListItem>
                <asp:ListItem Value="http://naver.com">Item #2</asp:ListItem>
                <asp:ListItem Value="http://yahoo.co.kr">Item #3</asp:ListItem>
                <asp:ListItem Value="http://google.co.kr">Item #4</asp:ListItem>
            </asp:BulletedList>
            </td>
           
            <td>
            <h3>Square</h3>
            <asp:BulletedList ID="BulletedList3" BulletStyle="square" DisplayMode="LinkButton" runat="server" OnClick="BulletedList3_Click">
                <asp:ListItem>Item #1</asp:ListItem>
                <asp:ListItem>Item #2</asp:ListItem>
                <asp:ListItem>Item #3</asp:ListItem>
                <asp:ListItem>Item #4</asp:ListItem>
            </asp:BulletedList>
            </td>
           
           
            <td style="width: 90px">
            <h3>Numbered</h3>
            <asp:BulletedList ID="BulletedList4" BulletStyle="Numbered" FirstBulletNumber="3" runat="server">
                <asp:ListItem>Item #1</asp:ListItem>
                <asp:ListItem>Item #2</asp:ListItem>
                <asp:ListItem>Item #3</asp:ListItem>
                <asp:ListItem>Item #4</asp:ListItem>
            </asp:BulletedList>
            </td>
           
            </tr>
           
        </table>
    </div>
    </form>
</body>
</html>