Dynamically Adding Multiple User Controls vb.net
Posted
by
Jamie Hartnoll
on Stack Overflow
See other posts from Stack Overflow
or by Jamie Hartnoll
Published on 2012-02-27T11:38:05Z
Indexed on
2012/09/25
9:37 UTC
Read the original article
Hit count: 353
I have a User Control which returns a table of data, which in some cases needs to be looped, displaying one on top of another.
I am able to dynamically add a single instance of this by placing a fixed placeholder
in the page.
I am now trying to work out how to add more than one, given that I don't know how many might be needed I don't want to hard code the Placeholders.
I've tried the following, but I am just getting one instance, presumably the first is being overwritten by the second
My HTML
<div id="showHere" runt="server"/>
VB
Dim thisPh As New PlaceHolder
thisPh.Controls.Add(showTable)
showHere.Controls.Add(thisPh)
Dim anotherPh As New PlaceHolder
anotherPh .Controls.Add(showTable)
showHere.Controls.Add(anotherPh)
How do I make it add repeated tables within the showHere
div?
© Stack Overflow or respective owner