0

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");


}
3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by mitulmodi.rcc
0

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!!!

-1

u can try this with the method

if(!Ispostback)

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.