asp.net中GridView的CheckedUnBindCheckBox属性

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

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

        string test = "";

        for (int i = ; i < GridView1.Rows.Count; i++)
{
if (((CheckBox)(GridView1.Rows[i].Cells[].Controls[])).Checked == true)
{
test += GridView1.Rows[i].Cells[].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>
上一篇:什么是比特币(bitcoin)


下一篇:How to: cgminer (Bitcoin, Litecoin etc.) + AMD Radeon driver install on CentOS