• ASP.NET中 RadioButtonList(单选按钮组),CheckBoxList(复选框组),DropDownList(下拉框),ListBox(列表框),BulletedList(无序列表)的使用前台绑定


    ylbtech-ASP.NET-Control-Bind:RadioButtonList(单选按钮组),CheckBoxList(复选框组),DropDownList(下拉框),ListBox(列表框),BulletedList(无序列表)的使用前台绑定

     ASP.NET中 RadioButtonList(单选按钮组),CheckBoxList(复选框组),DropDownList(下拉框),ListBox(列表框),BulletedList(无序列表)的使用前台绑定。

    1.A,运行效果图返回顶部
    1.B,源代码返回顶部
    /RadioButtonList.aspx
    <h3>单选按钮组</h3>
    <asp:RadioButtonList ID="RadioButtonList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="CompanyName" DataValueField="ShipperId">
    </asp:RadioButtonList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
        SelectCommand="SELECT [ShipperID], [CompanyName] FROM [Shippers]">
    </asp:SqlDataSource>
    /CheckBoxList.aspx
    <h3>多选框组</h3>
    <asp:CheckBoxList ID="CheckBoxList1" runat="server" DataSourceID="SqlDataSource1"
        DataTextField="ProductName" DataValueField="ProductID">
    </asp:CheckBoxList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString2 %>"
        SelectCommand="SELECT [ProductID], [ProductName] FROM [Products]"></asp:SqlDataSource>
    /DropDownList.aspx
    <h3>下拉框</h3>
    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" 
        DataTextField="CategoryName" DataValueField="CategoryID">
    </asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
        SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories]">
    </asp:SqlDataSource>
    /ListBox.aspx
    <h3>列表框</h3>
    <asp:ListBox ID="ListBox1" runat="server" DataSourceID="SqlDataSource1" 
        DataTextField="CompanyName" DataValueField="ShipperID"></asp:ListBox>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
        SelectCommand="SELECT [ShipperID], [CompanyName] FROM [Shippers]">
    </asp:SqlDataSource>
    /BulletedList.aspx
    <h3>无序列表</h3>
    <asp:BulletedList ID="BulletedList1" runat="server" 
        DataSourceID="SqlDataSource1" DataTextField="CompanyName" 
        DataValueField="CustomerID">
    </asp:BulletedList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
        SelectCommand="SELECT [CustomerID], [CompanyName] FROM [Customers]">
    </asp:SqlDataSource>
    /web.config
    <connectionStrings>
            <add name="NorthwindConnectionString" connectionString="Data
                        Source=.;Initial Catalog=Northwind;Integrated Security=True"
                            providerName="System.Data.SqlClient"/>
        </connectionStrings>
    1.C,资源下载返回顶部

     无。

    warn 作者:ylbtech
    出处:http://ylbtech.cnblogs.com/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    安装好Ruby,使用Windows Powershell不能使用
    关于css注释在sublime中的问题
    腾讯云服务器Centos使用心得
    火狐浏览器打开后出现两个主页,其中一个为hao123
    找兴趣点切入
    canvas绘制饼状图
    关于(function(){})(); 的一些理解
    sublime标签页不能显示的解决方法
    ubuntu下jdk安装与环境配置
    Array和ArrayList的Clone为什么一个不用类型转换,一个要类型转换
  • 原文地址:https://www.cnblogs.com/ylbtech/p/2944390.html
Copyright © 2020-2023  润新知