I want to add check box inside grid view.But I don't want to add the check box in rows, I want to add the check box in column header. Thank You
I want get the output like given below..
You need to create a Checkbox HeaderTemplate field in GridView:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField ItemStyle-Width="40px">
<HeaderTemplate>
<asp:CheckBox ID="chkboxSelectAll" runat="server" onclick="CheckAllEmp(this);" />
</HeaderTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemTemplate>
<asp:CheckBox ID="chkEmp" runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
For further details you can refer to these sites: site1
Try this
<columns>
<asp:templatefield>
<itemtemplate>
<%#Eval("fname")%>
</itemtemplate>
<headertemplate>
<asp:checkbox id="ShowAllCheckBox"
checked="True"
runat="server"/>
</headertemplate>
</asp:templatefield>
</columns>
Hope this helps you
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.