大家好,想请问一下大家,在GridView编辑列中可以添加CheckBoxField列,但是这个列好像是只读的,怎么让它变成可用,也就是可以让我自己去选中或者取消?

解决方案 »

  1.   

    使用模板列,里面你用CheckBox就行了。
      

  2.   


    <asp:TemplateField>
       <ItemTemplate>
           <asp:CheckBox ID="chk" runat="server"/>
       </ItemTemplate>
    </asp:TemplateField>
      

  3.   

    Gridview用法总结

    里面有你想要的。
    下载源代码后,好好研究和享受吧
      

  4.   

    <asp:TemplateField HeaderText="">
    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="8%"></HeaderStyle>
    <ItemStyle HorizontalAlign ="Center" />
    <ItemTemplate>
    <asp:CheckBox id="CheckBox1" runat="server" Enabled='<%#Eval("Status")%>' ToolTip='<%#Eval("Id")%>'>
    </asp:CheckBox>
    </ItemTemplate>
    foreach (GridViewRow gr in this.gvPro.Rows)
      {
      CheckBox chk = gr.FindControl("CheckBox1") as CheckBox;
      if (chk.Checked)
      {  }
      } </asp:TemplateField>