How can I put CheckBox in WebGrid's header, in order to realize check all or check no?
Hello,You can use the template columns and put the check box into header and cell Please take a look at the sample code below:
<igtbl:TemplatedColumn> <CellTemplate> <asp:CheckBox ID="CheckBox1" runat="server" /> </CellTemplate> <HeaderTemplate> <asp:CheckBox ID="CheckBox2" runat="server" /> </HeaderTemplate> </igtbl:TemplatedColumn>
Hope this helps.
Hello:
Now I can put checkbox into the WebGrid's header. But I found a problem that is I only put checkbox into WebGrid's header which doesn't has sub-table. Why I coundn't put checkbox into sub-table's header?
Thanks your answer. But I found it wasn't right by your advice. Why? I run the program and didn't find the checkbox display in the header. The code of page is below:
<igtbl:TemplatedColumn BaseColumnName="ReceiveState" Key="ReceiveState" DataType="System.Boolean" Type="CheckBox"> <Header Caption="接收" /> <HeaderStyle HorizontalAlign="center" /> <CellStyle HorizontalAlign="center" /> <HeaderTemplate> <asp:CheckBox ID="cbAll" runat="server" /> </HeaderTemplate></igtbl:TemplatedColumn>