Following is the simplest way to get checked checkbox in a
grid:
<asp:GridView runat="server" ID="grd" AutoGenerateColumns="false">
<EmptyDataTemplate>
No data found
</EmptyDataTemplate>
<Columns>
<asp:TemplateField HeaderStyle-Width="4%">
<HeaderTemplate>
<input type="checkbox" id="cbUserAll" title="Select/Unselect
All" onclick="SelectAllCB('ckbUser', this);" />
</HeaderTemplate>
<ItemTemplate>
<input type="checkbox" id='ckbUser<%#Eval("Id")%>' name="ckbUser" value='<%#Eval("Id")%>' />
</ItemTemplate>
In CS page:
string str = Convert.ToString(Request.Form["ckbuser"]);
This will get all selected checkbox values comma separated.
No comments:
Post a Comment