zoukankan      html  css  js  c++  java
  • 基本的Web控件三

    基本的Web控件用法一

     

    ListBox控件

      页面布局:

    <div>
            <h1>ListBox控件</h1>
            学生列表:
            <br/>
            <asp:ListBox ID="ListBox1" runat="server" Height="100px" Width="200px" Font-Size="Large"
                onselectedindexchanged="ListBox1_SelectedIndexChanged" AutoPostBack="true" >
                <asp:ListItem>张勇</asp:ListItem>
                <asp:ListItem>张力</asp:ListItem>
                <asp:ListItem>张译</asp:ListItem>
            </asp:ListBox>
            <br/>
            <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
            <hr/>
            <hr/>
    </div>
    

       后台代码:

    protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
    	this.Label1.Text = "你选择的学生是:" + 	this.ListBox1.SelectedItem.Text.ToString();
    }
    

    DropDownList控件

      页面布局:

    <div>
            <h1>DropDownList控件</h1>
            学生列表:
            <br/>
            <asp:DropDownList ID="DropDownList1" Font-Size="Large" runat="server" AutoPostBack="true" Width="146px"
           OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem>张宇</asp:ListItem> <asp:ListItem>张容</asp:ListItem> <asp:ListItem>张度</asp:ListItem> </asp:DropDownList> <br/> <asp:Label ID="Label2" runat="server"></asp:Label> <hr/> <hr/> </div>

      后台代码:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
    	this.Label2.Text="你选择的学生是:" 	+this.DropDownList1.SelectedItem.Text.ToString();
    }
    

    CheckBoxList控件

      页面布局:

    <div>
            <h1>CheckBoxList控件</h1>
            <asp:CheckBoxList ID="CheckBoxList1" runat="server" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged"
    AutoPostBack="true" Width="180px"> <asp:ListItem>苹果</asp:ListItem> <asp:ListItem>香蕉</asp:ListItem> <asp:ListItem>桔子</asp:ListItem> <asp:ListItem>桂圆</asp:ListItem> <asp:ListItem>葡萄</asp:ListItem> </asp:CheckBoxList> <br/> <asp:Label ID="Label3" runat="server"></asp:Label> <hr/> <hr/> </div>

        后台代码:

    protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
    {
            this.Label3.Text = "你的选择是:" + this.CheckBoxList1.SelectedItem.Text.ToString();
    }
    

    RadioButtonList控件

      页面布局:

    <div>
            <h1>RadioButtonList控件</h1>
            <asp:RadioButtonList ID="RadioButtonList1" runat="server" Width="180px">
                <asp:ListItem>乒乓球</asp:ListItem>
                <asp:ListItem>保龄球</asp:ListItem>
                <asp:ListItem>羽毛球</asp:ListItem>
            </asp:RadioButtonList>
            <hr/>
            <hr/>
    </div>
    

    BulletedList控件

      页面布局:

    <div>
            <h1>BulletedList控件</h1>
            <asp:BulletedList ID="BulletedList1" runat="server" BulletStyle="Square">
                <asp:ListItem>鸡</asp:ListItem>
                <asp:ListItem>鸭</asp:ListItem>
                <asp:ListItem>猪</asp:ListItem>
                <asp:ListItem>狗</asp:ListItem>
            </asp:BulletedList>
            <hr/>
            <hr/>
    </div>
    

    Table控件

      页面布局:

    <div>
            <h1>Table控件</h1>
            <asp:Table ID="Table1" runat="server">
                <asp:TableRow runat="server">
                    <asp:TableCell runat="server">第一行第一列</asp:TableCell>
                    <asp:TableCell ID="TableCell1" runat="server">第一行第二列</asp:TableCell>
                    <asp:TableCell ID="TableCell2" runat="server">第一行第三列</asp:TableCell>
                    <asp:TableCell ID="TableCell3" runat="server">第一行第四列</asp:TableCell>
                </asp:TableRow>
                <asp:TableRow ID="TableRow1" runat="server">
                    <asp:TableCell ID="TableCell4" runat="server">第二行第一列</asp:TableCell>
                    <asp:TableCell ID="TableCell5" runat="server">第二行第一列</asp:TableCell>
                    <asp:TableCell ID="TableCell6" runat="server">第二行第二列</asp:TableCell>
                    <asp:TableCell ID="TableCell7" runat="server">第二行第三列</asp:TableCell>
                </asp:TableRow>
            </asp:Table>
            <hr/>
            <hr/>
    </div>
    

    原文链接:

    http://blog.csdn.net/spilledlight/article/details/48711979

  • 相关阅读:
    锋利的jQuery第2版学习笔记4、5章
    锋利的jQuery第2版学习笔记1~3章
    关于盒模型的理解
    CSS3秘笈第三版涵盖HTML5学习笔记13~17章
    CSS3秘笈第三版涵盖HTML5学习笔记9~12章
    CSS3秘笈第三版涵盖HTML5学习笔记6~8章
    CSS3秘笈第三版涵盖HTML5学习笔记1~5章
    锁(1):spin_lock & mutex_lock的区别? .
    休眠(1):sleep和wait的区别
    C++(1):error: invalid conversion from ‘void (*)()’ to ‘void (*)(int)
  • 原文地址:https://www.cnblogs.com/spilledlight/p/4840999.html
Copyright © 2011-2022 走看看