Scenario: I have a sidebar to my site in which widgets sit. I have 6 different templates (ascx controls) for which theses widgets could use - the template location is set in admin. All of the templates have a property which accept an object of 'SideBar' so the content of the ascx control can be populated.
Each site section has a different number of widgets in the side bars, pulled out in to a collection.
i.e:
what I would do next is place the control in the page, but before I do that I need to pass to my sidebar the widget object so the template can be filled with the object data.
How would I go about passing my object to the 'unknown' control type?
Each site section has a different number of widgets in the side bars, pulled out in to a collection.
i.e:
PHP:
SideBarCollection sidebarwidgets = SideBarManager.GetSideBarBySiteSectionID(68);
Control c;
foreach (SideBar sideb in sidebarwidgets)
{
c = LoadControl(sideb.TemplateLocation);
//i need to pass sideb to c here
placeholder.controls.add(c);
}
what I would do next is place the control in the page, but before I do that I need to pass to my sidebar the widget object so the template can be filled with the object data.
How would I go about passing my object to the 'unknown' control type?
Last edited: