Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1435
  • Last Modified:

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;

   }
0
ziggie301
Asked:
ziggie301
  • 3
  • 3
1 Solution
 
Kevin CrossChief Technology OfficerCommented:
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.
0
 
NullableCommented:
HI
you MUST add Your PlaceHolder Object in Page.Controls
0
 
Kevin CrossChief Technology OfficerCommented:
Ah, see how little I do with design.  Guess I should just go back to my server/business objects little hole. :) Nice answer Nullable.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
NullableCommented:
i dont see your answer mwvisa1

0
 
Kevin CrossChief Technology OfficerCommented:
I answered above, but yours is correct which is why I was giving you kudos!
0
 
NullableCommented:
sorry i use bad VERB ( SEE )
i must use ( seen )(past)

my english is bad :(
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now