I have nested asp repeaters

<asp:repeater id="ParentRepeater" runat="server" OnItemDataBound="repMenu1_ItemDataBound">  
    <itemtemplate>  
        <table>  
            <tr>  
                <td>  
                    <asp:CheckBox id="CheckBox1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"DESCRIPTION") %>' OnCheckedChanged="chkBox_CheckedChanged" >  
                    </asp:CheckBox>  
                </td>  
            </tr>  
            <tr>  
                <td>  
                    <!-- start child repeater -->  
                    <asp:repeater id="childRepeater" runat="server">  
                        <itemtemplate>  
                            <TABLE id="Table1" border="0" cellSpacing="0" cellPadding="0" width="1000">  
                                <TR>  
                                    <TD><%# DataBinder.Eval(Container.DataItem,"Trx") %></TD>  
                                    <TD><%# DataBinder.Eval(Container.DataItem,"GL") %></TD>  
                                    <TD><%# DataBinder.Eval(Container.DataItem,"Amount") %></TD>  
                                </TR>  
                            </TABLE>  
                        </itemtemplate>  
                    </asp:repeater>  
                    <!-- end child repeater -->  
                </td>  
            </tr>  
            <tr>  
            </tr>  
        </table>  
    </itemtemplate>  
</asp:repeater>

I use if(! Page.postback) to fill those two repeaters

I want to get the data related to checked checkboxes when using the below code it get only the data of the first checked box

how to make it brign all the data

private void Btn_Confirm_Click(object sender, System.EventArgs e)
{
//CheckBox checkedButton = null; 


foreach (RepeaterItem item in ParentRepeater.Items) 
{ 

CheckBox control=(CheckBox)item.FindControl("CheckBox1"); 
if (control.Checked) 
{ 
//checkedButton = control; 

foreach(DataRow r in GetInnerData(control.Text).Rows  )   // GetInnerData is used to pring datarelated to the selected check box 
{
if(r["DESCRIPTION"].ToString() == control.Text)
{
Response.Write(r["DESCRIPTION"].ToString() + r["Date" ].ToString() + r[ "Trx" ].ToString() + r[ "GL" ].ToString() +  r["Amount" ].ToString() +"\n");


}

I have nested asp repeaters

<asp:repeater id="ParentRepeater" runat="server" OnItemDataBound="repMenu1_ItemDataBound">  
    <itemtemplate>  
        <table>  
            <tr>  
                <td>  
                    <asp:CheckBox id="CheckBox1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"DESCRIPTION") %>' OnCheckedChanged="chkBox_CheckedChanged" >  
                    </asp:CheckBox>  
                </td>  
            </tr>  
            <tr>  
                <td>  
                    <!-- start child repeater -->  
                    <asp:repeater id="childRepeater" runat="server">  
                        <itemtemplate>  
                            <TABLE id="Table1" border="0" cellSpacing="0" cellPadding="0" width="1000">  
                                <TR>  
                                    <TD><%# DataBinder.Eval(Container.DataItem,"Trx") %></TD>  
                                    <TD><%# DataBinder.Eval(Container.DataItem,"GL") %></TD>  
                                    <TD><%# DataBinder.Eval(Container.DataItem,"Amount") %></TD>  
                                </TR>  
                            </TABLE>  
                        </itemtemplate>  
                    </asp:repeater>  
                    <!-- end child repeater -->  
                </td>  
            </tr>  
            <tr>  
            </tr>  
        </table>  
    </itemtemplate>  
</asp:repeater>

I use if(! Page.postback) to fill those two repeaters

I want to get the data related to checked checkboxes when using the below code it get only the data of the first checked box

how to make it brign all the data

private void Btn_Confirm_Click(object sender, System.EventArgs e)
{
//CheckBox checkedButton = null; 


foreach (RepeaterItem item in ParentRepeater.Items) 
{ 

CheckBox control=(CheckBox)item.FindControl("CheckBox1"); 
if (control.Checked) 
{ 
//checkedButton = control; 

foreach(DataRow r in GetInnerData(control.Text).Rows  )   // GetInnerData is used to pring datarelated to the selected check box 
{
if(r["DESCRIPTION"].ToString() == control.Text)
{
Response.Write(r["DESCRIPTION"].ToString() + r["Date" ].ToString() + r[ "Trx" ].ToString() + r[ "GL" ].ToString() +  r["Amount" ].ToString() +"\n");


}

Hi there

you need another loop inside parent repeater

foreach(DataRow r in GetInnerData(control.Text).Rows  )   
{
      //foreach(DataRow r in .....
          { //do your stufff

Mark as solved if it helps you!!!

u can try this with the method

if(!Ispostback)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.