Solved

Dynamic PlaceHolder

Posted on 2008-10-28
6
1,417 Views
Last Modified: 2013-12-17
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
Comment
Question by:ziggie301
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 22827804
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
 
LVL 1

Accepted Solution

by:
Nullable earned 500 total points
ID: 22827805
HI
you MUST add Your PlaceHolder Object in Page.Controls
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 22827822
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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 1

Expert Comment

by:Nullable
ID: 22827873
i dont see your answer mwvisa1

0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 22827915
I answered above, but yours is correct which is why I was giving you kudos!
0
 
LVL 1

Expert Comment

by:Nullable
ID: 22827932
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question