How can I put CheckBox in WebGrid's header, in order to realize check all or check no?
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?
Insead of templated column, we can go with normal check box type column. And for this check box column header text we can have the below text:
<div><input type = 'checkbox' name = 'cbSelectAll' checked='checked' onclick='SelectAll();'></div>
Write a simple javascript function to read the check box values from individual rows and set the corresponding value in check box 'cbSelectAll'
Best Regards,
Vijay
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>
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.