Solved

Dynamic PlaceHolder

Posted on 2008-10-28
6
1,421 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 60

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 60

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
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!

 
LVL 1

Expert Comment

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

0
 
LVL 60

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

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

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 …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

615 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