Solved

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

Posted on 2004-10-27
242 Views
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  .
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);  
}

       
0
Question by:Carl3003
    2 Comments
     
    LVL 15

    Assisted Solution

    by:Thogek
    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
     
    LVL 3

    Accepted Solution

    by:
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles al…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    860 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now