zoukankan      html  css  js  c++  java
  • 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/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    向iphone模拟器中导入图片
    键盘样式风格设置及隐藏
    (转)iPhone图片处理:摄像头/相册获取图片,压缩图片,上传服务器,下载,拉伸,方法总结
    python通过get方式,post方式发送http请求和接收http响应-urllib urllib2
    Python中 如何使用telnet 检测端口是否通
    Linux运维人员共用root帐户权限审计
    python ssh登录
    欢迎来到 Flask 的世界
    大杂烩
    随笔
  • 原文地址:https://www.cnblogs.com/ylbtech/p/2944390.html
Copyright © 2011-2022 走看看