I know this is possible but I just don't know how to make it happen. I need to create multiple Repeater Controls from code behind in ASP.NET C#. I know how to create the repeater dynamically as well the HeaderTemplate and FooterTemplate. Where I'm having issues is on the ItemTemplate. I don't know how to bind the fields coming from the DataSource. I've seen many examples but none of them work.
This is how I'm building my HeaderTemplate:
TemplateBuilder hdr = new TemplateBuilder();
hdr.AppendLiteralString("<table><thead><tr><th>Team</th></tr></thead>");
And this is how I'm building my FooterTemplate:
TemplateBuilder ftr = new TemplateBuilder();
ftr.AppendLiteralString("</table>");
This is how I'm associating my templates to the repeater:
Repeater repeater1 = new Repeater();
repeater1.DataSource = Connections.isp_GET_GRIDVIEW_DATA("STDNG", group, "", "");
repeater1.HeaderTemplate = hdr;
repeater1.ItemTemplate = dtl;
repeater1.FooterTemplate = ftr;
repeater1.DataBind();
Now my issue is with this part of the code:
TemplateBuilder dtl = new TemplateBuilder();
dtl.AppendLiteralString(???);
How do I create the template for the repeater1.ItemTemplate? How can I bind the data?