简体   繁体   English

如何在DatagridviewCheckBoxColumn的Header添加复选框控件?

[英]How to add checkbox control at the Header of DatagridviewCheckBoxColumn?

Can anyone please provide the C# coding to add checkbox control at the Header of DatagridviewCheckBoxColumn.谁能提供 C# 编码以在 DatagridviewCheckBoxColumn 的 Header 添加复选框控件。

Convert the Check Box Column to a template field.将复选框列转换为模板字段。 Then add the Check box to the header template.然后将复选框添加到 header 模板。

I think WarithNath is right.我认为 WarithNath 是对的。 Here is a suggestion code.这是一个建议代码。

<asp:TemplateField>
   <EditItemTemplate>
        <asp:CheckBox ID="CheckBox1" runat="server" />
   </EditItemTemplate>
   <ItemTemplate>
        <asp:CheckBox ID="CheckBox1" runat="server" />
   </ItemTemplate>
   <HeaderTemplate>
       <asp:CheckBox ID="CheckBoxToSelectAll" runat="server" />
   </HeaderTemplate>

</asp:TemplateField>

Hope it works!希望它有效!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM