ziggie301
asked on
Dynamic PlaceHolder
Hello.
I need to create a placeholder dynamically, containing dynamical content. If I create the placeholder at design time everything is ok. If I do create a placeholder and add the table with my data to it, it doesn't show to screen. What's wrong?
protected void Page_Load(object sender, EventArgs e)
{
PlaceHolder aPlaceHolder = new PlaceHolder();
aPlaceHolder.Controls.Add( MyTable);
aPlaceHolder.Visible = true;
}
I need to create a placeholder dynamically, containing dynamical content. If I create the placeholder at design time everything is ok. If I do create a placeholder and add the table with my data to it, it doesn't show to screen. What's wrong?
protected void Page_Load(object sender, EventArgs e)
{
PlaceHolder aPlaceHolder = new PlaceHolder();
aPlaceHolder.Controls.Add(
aPlaceHolder.Visible = true;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ah, see how little I do with design. Guess I should just go back to my server/business objects little hole. :) Nice answer Nullable.
i dont see your answer mwvisa1
I answered above, but yours is correct which is why I was giving you kudos!
sorry i use bad VERB ( SEE )
i must use ( seen )(past)
my english is bad :(
i must use ( seen )(past)
my english is bad :(
You could still dynamically create PlaceHolder objects and just use your first one for where to place on page say if you have multiple placeholder objects you are creating for some reason.
Otherwise, the one on the design surface should be able to take in as many controls as you want.
I have never tried it, but guess you could try to add this to another layout style control like a panel or something.