How do you copy objects from one placeholder into another..

In my sample i wanted to create another placeholder with the same objects in it and place it in a different part of the page but for some reasons i could not just say phMyLinks=phMyLinks2 . I also tried to populate both placeholders at run time but it was populating only one of them. One way was  to explicitely create another LinkButton and to make all actions parallel to both placeholders. I am looking to find an easier solution whereas i could populate both placeholders altogether  .
Thanks

Label lblPage=new Label();
lblPage.Text="Page : ";
this.phMyLinks.Controls.Add(lblPage);      
for(int i=1;i<=pageTotal;i++)
{
      myLink=new LinkButton();
      myLink.Text=" " + Convert.ToString(i) + " ";
      myLink.Click+=new EventHandler(myLink_Click);
      phMyLinks.Controls.Add(myLink);  //this becomes empty
                phMyLinks1.Controls.Add(myLink);  
}

       
Carl3003Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ThogekCommented:
I think that a given control/object can only exist within one PlaceHolder (or one containing object) at a time.  (Otherwise, that control's Parent property would get rather confused.)  You may have to build two copies of each control so that you can place one into each PlaceHolder.
0
nitrogenxCommented:
This article talks about cloning: http://www.ondotnet.com/pub/a/dotnet/2002/11/25/copying.html?page=2
It may help you to understand what you're trying to do and why its not easilly possible.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.