Go Premium for a chance to win a PS4. Enter to Win


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

Posted on 2004-10-27
Medium Priority
Last Modified: 2012-05-05
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  .

Label lblPage=new Label();
lblPage.Text="Page : ";
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

Question by:Carl3003
LVL 15

Assisted Solution

Thogek earned 80 total points
ID: 12426568
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.

Accepted Solution

nitrogenx earned 120 total points
ID: 12427224
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.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 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