Link to home
Start Free TrialLog in
Avatar of ziggie301
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;

   }
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

It doesn't know where to put it.  Usually I will put in a placeholder in design time and then add the controls to it dynamically.  You could place it where it should be and make it Visible = false.

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.
ASKER CERTIFIED SOLUTION
Avatar of Nullable
Nullable
Flag of Iran, Islamic Republic of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 :(