Reusing a asp:repeater?

  • Thread starter Thread starter dauphian
  • Start date Start date
D

dauphian

Greetings,

I am using a user control to do the work, and have figured most of it
out so far, cept the below:

I am currently trying to do the following:

- query to get a count of items in a db
- for each item, query a different table and display results

So far I am able to query the table and display one set of results, but
I need to be able to add in the initial query to get count and then
have a repeater display (x) amount of times.

For example:

Item 1
ID Data
1001 Blah Blah
1002 Blah Blah

Item 2
ID Data
1001 Blah Blah
1002 Blah Blah

Right now I am able to have 1 item work with hardcoding criteria...but
the above is what I need for it to do.

Thanks in advance!
 
I am very close..Right now it works, but it only shows me 1 entry,
where there should be 2 different repeaters showing information:

for (int i = 0; i <
dsSites.Tables["ar_sites_table"].Rows.Count; i++)
{
siteCode =
dsSites.Tables["ar_sites_table"].Rows["site_code"].ToString();
siteName =
dsSites.Tables["ar_sites_table"].Rows["site_name"].ToString();
siteID =
dsSites.Tables["ar_sites_table"].Rows["site_id"].ToString();
addLink = "dsp_CampaignsAdd.aspx?=" + siteID;

string query = "SELECT * FROM " + siteCode +
"_campaign_table ORDER BY campaign_name";

myRepeater.ID = "myRepeater" + i.ToString();
myRepeater.DataSource = fetchData(query);
myRepeater.DataBind();

PlaceHolder1.Controls.Add(myRepeater);

PlaceHolder1.Controls.Add(new LiteralControl("<br />"));
}

Any thoughts on how to dynamically display the correct number of user
controls? In this case repeaters...
 
Back
Top