Probelm in looping nested repeater control

Joined
Dec 10, 2009
Messages
1
Reaction score
0
Hi,

I am trying to have nested repeater control but I am not getting it write I guess I am missing something in looping

Here is my code:
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
BindData();
}

private void BindData()
{
Setup();
ArrayList ar = new ArrayList();

// this brings all rows having column1
//didn't show that querying as I m sure its working fine
foreach (SPListItem i in qryOrg("")) {
String strPrg = (String)i["ProgramCategory"];

ar.Add(strPrg.Trim());


}
ar = RemoveDups(ar);


Repeater1.DataSource = ar;
Repeater1.DataBind();



foreach (RepeaterItem rptrItem in Repeater1.Items)
{
ArrayList ar1 = new ArrayList();
ar1.Clear();


for (int i = 0; i < ar.Count - 1; i++)
{

String t = ar.ToString();
))//qryPBook(t) is SPListitemcollection getting all the values of column2 which are related to column1


foreach (SPListItem j in qryPBook(t)
{



String t1 = (String)j["Title"];//selects one field out of the above rows
ar1.Add(t1);




}
((Repeater)(rptrItem.FindControl("Repeater2"))).DataSource = ar1;
((Repeater)(rptrItem.FindControl("Repeater2"))).DataBind();
//goto prog;

}

}


the output is coming out to be

A
1.
2,
3
4

B

1.
2,
3
4
C

1.
2,
3
4

Instead it shoud be

A
1
2

B
3

c
4


I would really appreciate if someone can help me with this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top