Hi Frnz
I have some checkboxes in Datagrid, out of that datagrid i have a checkbox. if i select that checkbox then i should select all the checkboxes in datagrid. please help me out.
<asp:GridView ID="gvApplicable" runat="server" AutoGenerateColumns="False"
AllowSorting="True" AllowPaging="True" PageSize="15" onrowediting="gvApplicable_RowEditing"
onpageindexchanging="gvApplicable_PageIndexChanging" Height="127px"
onselectedindexchanged="gvApplicable_SelectedIndexChanged" Width="213px" >
<Columns>
<asp:TemplateField >
<ItemTemplate>
<asp:CheckBox ID="Chk1" runat="server" />
ItemTemplate>
asp:TemplateField>
<asp:BoundField ReadOnly="true" DataField="DeptCode" HeaderText="Code" InsertVisible="false" SortExpression="Code">asp:BoundField>
<asp:BoundField ReadOnly="true" DataField="DeptName" HeaderText="Category" InsertVisible="false" SortExpression="Name">asp:BoundField>
Columns>
asp:GridView>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" Text="Select" CssClass="TableList"
Height="25px" Width="126px" oncheckedchanged="CheckBox1_CheckedChanged">asp:CheckBox>
Loading

Krishna GaradRank #191 · 12.8K reputationPosted Dec 22, 2010, 2:20 AM EST
Soft CornerRank #1,221 · 1.5K reputationPosted Dec 22, 2010, 2:43 AM EST
1. Generate CheckBox1_CheckedChanged event in ur code
2. Implement this code in above event
CheckBox chkbox = new CheckBox();
foreach (GridViewRow row in gvApplicable.Rows)
{
chkbox = (CheckBox)row.FindControl("Chk1");
if (chkbox.Checked == false)
{
chkbox.Checked = true;
}
else
{
chkbox.Checked = false;
}
}
Suthish NairRank #92 · 22.8K reputationPosted Dec 23, 2010, 10:14 PM EST
Your query resolved?
sandeep kodepaka97 reputationPosted Dec 24, 2010, 1:13 AM EST
thanks for the mail
sandeep kodepaka97 reputationPosted Dec 24, 2010, 1:15 AM EST
Soft CornerRank #1,221 · 1.5K reputationPosted Dec 24, 2010, 1:20 AM EST
Satyapriya NayakRank #47 · 31.5K reputationPosted Dec 24, 2010, 8:30 AM EST
When i click the select CheckBox all the checkboxes in gridview are checked but when i uncheck the select CheckBox all the checkboxes in gridview are not unchecked.how to do it.
Thanks
Suthish NairRank #92 · 22.8K reputationPosted Dec 24, 2010, 8:27 PM EST
Please start a new thread. This thread is already resolved, nobody will be interested in replying.