Devendra  Kumar

Devendra Kumar

  • NA
  • 517
  • 244.4k

inside nested grid view checkbox checked value get

Aug 3 2016 8:10 AM
<asp:GridView ID="grdOpen" runat="server" AutoGenerateColumns="false" CssClass="GridView1"
HeaderStyle-BackColor="#108ec0" HeaderStyle-ForeColor="White" DataKeyNames="transactionId"
OnRowDataBound="OnRowDataBound" Width="98%" OnRowCommand="grdOpen_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<img alt="" style="cursor: pointer" src="../images/plus.png" />
<asp:Panel ID="pnlOrders" runat="server" Style="display: none">
<asp:GridView ID="grdOpendetails" runat="server" AutoGenerateColumns="false" CssClass="GridView1"
HeaderStyle-BackColor="#108ec0" HeaderStyle-ForeColor="White" Width="90%">
<Columns>
<asp:TemplateField HeaderText="S No.">
<ItemTemplate>
<%# Container.DataItemIndex +1 %>.
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Ordr Date">
<ItemTemplate>
<asp:Label ID="date" Text='<%# Eval("Order Date","{0:dd/MM/yyyy}")%>' runat="server"></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Ship">
<ItemTemplate>
<asp:ImageButton ID="lnk_delete" runat="server" CommandName="ship1" CommandArgument='<%# Eval("transactionId") %>'
ImageUrl="~/images/ship_adbtn.png" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkall" runat="server" AutoPostBack="true" OnCheckedChanged="CheckedChanged_chkall" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkRow" runat="server" OnCheckedChanged="CheckedChanged_chkRow" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="S No." ItemStyle-Width="50px">
<ItemTemplate>
<%# Container.DataItemIndex +1 %>.
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
gn="Center" />
</asp:BoundField>
<asp:BoundField ItemStyle-Width="100px" DataField="Total Order" HeaderText="Total Order">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
</Columns>
</asp:GridView>
 
 
code is like:
 
 
protected void CheckedChanged_chkall(object sender, EventArgs e)
{
foreach (GridViewRow grid in grdOpen.Rows)
{
GridView gr = grid.FindControl("grdOpendetails") as GridView;
CheckBox chk = gr.FindControl("chkall") as CheckBox;
if (chk != null && chk.Checked == true)
{
}
}
}
 
 
how to get if header check box checked then how to get all checked value 

Answers (1)