I am struggling on something that, I am sure, should be easy. I have been living in backend and winforms code for a long time, and I'm am building my first ASP.NET page in over a year, so apologies for any noobishness
I am inside a User Control on a page.
On this User Control (Parent Control) I need to embed 0 .. n child user controls in a table, where each Child User control is representative of a row in a Listbox on the Parent User Control.
On the child user control I have a few properties that need setting, such as the id of the item in the list box that it represents.
As I see it, I can either
- Loop through this list box in code-behind, and try to dynamically insert table rows and child user controls into an existing tag, and set the object's properties, something I have yet to make work - the added controls just don't appear
- Use the old fashion ASP trick of looping through the items in the Listbox inside <% %> tags, and embed my < uc:ChildUserControl runat="server" > tags, but I'm not able to set the required properties on the ChildUserControl (I have tried a few things, but the main issue is I can't use <% %> in server controls)
- Do something else that is eluding me at present
Any ideas would be greatfully received