0

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

1 Answer 1

2

repeater control bound to the same data source as the listbox?

Sign up to request clarification or add additional context in comments.

1 Comment

I was considering that earlier, but it felt largely like a cludge, and something should be easier. That being said, I'm trying it now. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.