Hello,
I am trying to use a web user control I created in a repeater. I can get the control to display in the repeater but, the problem I am having is none of the properties I set when creating the control display on the page. The properties work if I create a single instance of the control without using the repeater. I am binding a collection of my object to the repeater.
I'd appreciate any help or if there is a better way to do this please let me know.
Thanks,
Bill
I am trying to use a web user control I created in a repeater. I can get the control to display in the repeater but, the problem I am having is none of the properties I set when creating the control display on the page. The properties work if I create a single instance of the control without using the repeater. I am binding a collection of my object to the repeater.
Code:
List<ZFMailerControl> zfMailerControls = new List<ZFMailerControl>();
// create controls and initialize the properties from datareader then add to List
while (dr.Read())
{
ZFMailerControl zfmc = new ZFMailerControl();
zfmc.ProductName = "test this " + counter.ToString();
zfMailerControls.Add(zfmc);
counter++;
}
// bind the List to the repeater
rptMailer.ItemTemplate = LoadTemplate ("ZFMailerControl.ascx");
rptMailer.DataSource = zfMailerControls;
rptMailer.DataBind();
I'd appreciate any help or if there is a better way to do this please let me know.
Thanks,
Bill