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