Need to make control equal to control

Discussion in 'ASP .Net' started by Ron Vecchi, Dec 11, 2003.

  1. Ron Vecchi

    Ron Vecchi Guest

    I have a situation where I need to make PlaceHolderA equal to
    PlaceHolderB
    and keep the contents of PlaceHolderB after PlaceHolderA has been destroyed.

    is this possible seeing that it is a referenced copy of PlaceHolderA?


    Thanks,
    --
    Ron Vecchi
    Ron Vecchi, Dec 11, 2003
    #1
    1. Advertising

  2. Hi Ron,

    I apologize for it if there is any misunderstanding.

    As I understand, what you want is getting the content of the placeholder.
    Please refer to the following code snippet.

    ...
    private void Button2_Click(object sender, System.EventArgs e)
    {
    foreach(Control b in PlaceHolder1.Controls)
    {
    if(b.GetType().ToString() =="System.Web.UI.WebControls.TextBox")
    {
    PlaceHolder2.Controls.Add ( b );
    ((TextBox)(b)).Attributes.Add("style",@"Z-INDEX: 103; LEFT: 116px;
    POSITION: absolute; TOP: 128px");
    }
    }
    }
    ...

    Does it answer your question? If I have misunderstood your concern, please
    feel free to let me know.

    Best regards,

    Jacob Yang
    Microsoft Online Partner Support
    Get Secure! ¨C www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    Jacob Yang [MSFT], Dec 11, 2003
    #2
    1. Advertising

  3. Ron Vecchi

    Ron Vecchi Guest

    What im tring to do is have a clone of a placeholder.
    It would be great if there was a WebControl.Clone() method.

    My situation is that I have a custom control that has two child PlaceHolder
    Controls.
    In most situations both placeholders will need to have the identical child
    control structure.

    Sorry for the bad questioning but what I should have asked is that is there
    a WebControl.Clone method or something similar?




    "Jacob Yang [MSFT]" <> wrote in message
    news:...
    > Hi Ron,
    >
    > I apologize for it if there is any misunderstanding.
    >
    > As I understand, what you want is getting the content of the placeholder.
    > Please refer to the following code snippet.
    >
    > ..
    > private void Button2_Click(object sender, System.EventArgs e)
    > {
    > foreach(Control b in PlaceHolder1.Controls)
    > {
    > if(b.GetType().ToString() =="System.Web.UI.WebControls.TextBox")
    > {
    > PlaceHolder2.Controls.Add ( b );
    > ((TextBox)(b)).Attributes.Add("style",@"Z-INDEX: 103; LEFT: 116px;
    > POSITION: absolute; TOP: 128px");
    > }
    > }
    > }
    > ..
    >
    > Does it answer your question? If I have misunderstood your concern, please
    > feel free to let me know.
    >
    > Best regards,
    >
    > Jacob Yang
    > Microsoft Online Partner Support
    > Get Secure! ¨C www.microsoft.com/security
    > This posting is provided "as is" with no warranties and confers no rights.
    >
    Ron Vecchi, Dec 11, 2003
    #3
  4. Hi Ron,

    Based on my research and experience, there is not such a WebControl.Clone()
    method for the PlaceHolder. I think that we can try to use the following
    code:

    ...
    private void Button2_Click(object sender, System.EventArgs e)
    {

    PlaceHolder2 = PlaceHolder1;
    PlaceHolder1.Dispose();
    foreach(Control b in PlaceHolder2.Controls)
    {
    if(b.GetType().ToString() =="System.Web.UI.WebControls.TextBox")
    {
    Response.Write("b.GetType().ToString()");
    PlaceHolder2.Controls.Add ( b );
    ((TextBox)(b)).Attributes.Add("style",@"Z-INDEX: 103; LEFT: 116px;
    POSITION: absolute; TOP: 128px");
    }

    }

    }
    ...

    I hope it helps.

    Best regards,

    Jacob Yang
    Microsoft Online Partner Support
    Get Secure! ¨C www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    Jacob Yang [MSFT], Dec 12, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Lilja
    Replies:
    4
    Views:
    364
    Shezan Baig
    Feb 28, 2005
  2. shah_satish2002

    How to make equal value

    shah_satish2002, Jul 17, 2007, in forum: VHDL
    Replies:
    0
    Views:
    355
    shah_satish2002
    Jul 17, 2007
  3. Martin Manns

    How can I make a function equal to 0?

    Martin Manns, Mar 21, 2008, in forum: Python
    Replies:
    13
    Views:
    449
    John Machin
    Mar 22, 2008
  4. thxBruin

    does webform control equal to asp.net control?

    thxBruin, Nov 12, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    99
    Teemu Keiski
    Nov 13, 2003
  5. mitch-co2
    Replies:
    2
    Views:
    264
    mitch-co2
    Feb 22, 2005
Loading...

Share This Page