• asp.net中GridView的CheckedUnBindCheckBox属性


    1. 获取GridView中CheckBox所选行的字段,即使是在绑定了数据源的时候,也可以获取选中的CheckedUnBindCheckBox对应的各个列的字段

       使用时根据实际情况适当的修改即可。

            string test = "";
    
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                if (((CheckBox)(GridView1.Rows[i].Cells[0].Controls[0])).Checked == true)
                {
                    test += GridView1.Rows[i].Cells[1].Text.ToString() + ",";
                }
            }            
    
            Response.Write("<script>alert('" + test + "')</script>");
            return;

    2. 附GridView的部分属性代码(自用)

    <asp:GridView ID="GridView1" Width="100%" runat="server" AllowMultiColumnSorting="False" DataSourceID="ObjeDataSource1" 
                    CssClass="ContentPageDataGrid" EnableModelValidation="True" FocusColor="" IsSortAscending="False" 
                    MouseOverColor="" NeedRowMark="False" NeedUnBindCheckBoxColumn="True" 
                    UnBindCheckBoxColumnHeaderTextAlign="Left" 
                    UnBindCheckBoxColumnLocation="FirstColumn" UnBindCheckBoxHeaderText="" 
                    UnBindCheckBoxText="" AutoGenerateColumns="False" BorderWidth="1px" 
                    CanRowClick="False">
    </asp:GridView>
  • 相关阅读:
    ps 玻璃效果
    svn 官方下载
    svn
    c# form 无标题
    app Inventor google 拖放手机代码块
    paas
    java 延迟
    c# 执行 cmd
    c # xml操作 (无法将类型为“System.Xml.XmlComment”的对象强制转换为类型“System.Xml.XmlElement”)
    eclipse 安装插件 link方式
  • 原文地址:https://www.cnblogs.com/code1992/p/3195531.html
Copyright © 2020-2023  润新知