Postback on Controls added to placeholder

Discussion in 'ASP .Net' started by =?Utf-8?B?QW5nZWw=?=, May 26, 2004.

  1. I have added controls to the placeholder control. All the controls that were added have EnableViewState = true including the placeholder. One of the controls has a button that performs a postback. My question is when the button is clicked and a postback is performed, the controls that were in the placeholder no longer appears on the screen! Am I doing something wrong here? Why are the controls back on the screen eventhough they have enable view state

    I am doing this rather than creating a Composite control for certain reasons. I just would like to know why adding controls in code to the placeholder no longer appears when a postback is performed

    Thanks....
     
    =?Utf-8?B?QW5nZWw=?=, May 26, 2004
    #1
    1. Advertising

  2. You have to recreate the controls when the page posts back.

    Enabling viewstate will enable the controls to wire themselves back up when
    they are added to the control tree again. If you set any of the properties
    of the child controls before adding them to the placeholder, you will need
    to set them up again before adding to placeholder. If you added the
    controls to the placeholder before changing any of the properties, the set
    values will appear simply by adding the control with the same ID to the
    placeholder on your postback. Then any events will fire such as button
    clicks, or text changed events.

    HTH,

    bill

    "Angel" <> wrote in message
    news:...
    > I have added controls to the placeholder control. All the controls that

    were added have EnableViewState = true including the placeholder. One of the
    controls has a button that performs a postback. My question is when the
    button is clicked and a postback is performed, the controls that were in the
    placeholder no longer appears on the screen! Am I doing something wrong
    here? Why are the controls back on the screen eventhough they have enable
    view state?
    >
    > I am doing this rather than creating a Composite control for certain

    reasons. I just would like to know why adding controls in code to the
    placeholder no longer appears when a postback is performed?
    >
    > Thanks....
     
    William F. Robertson, Jr., May 26, 2004
    #2
    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. Mark
    Replies:
    2
    Views:
    2,721
    Steve C. Orr [MVP, MCSD]
    Jul 6, 2004
  2. Anders K. Jacobsen [DK]

    Problem access usercontrol added to placeholder

    Anders K. Jacobsen [DK], Mar 8, 2005, in forum: ASP .Net
    Replies:
    9
    Views:
    516
    Anders K. Jacobsen [DK]
    Apr 1, 2005
  3. =?Utf-8?B?U2ltb24gV2FsbGlz?=

    Placeholder's controls disappear during postback

    =?Utf-8?B?U2ltb24gV2FsbGlz?=, Mar 9, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,200
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Mar 9, 2005
  4. nail

    Build control in a placeholder or like a placeholder

    nail, Sep 10, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    346
  5. Wen Ou

    controls in placeholder were lost after postback

    Wen Ou, Dec 1, 2004, in forum: ASP .Net Web Controls
    Replies:
    7
    Views:
    646
    Wen Ou
    Dec 4, 2004
Loading...

Share This Page