Losing Dropdownlist viewstate

Discussion in 'ASP .Net Web Controls' started by Dstl Web Team, Jan 9, 2004.

  1. Hi,

    I am using the placeholder to dynamically create a new row in a table
    that contains a dropdown list, a text box an a radio button on the
    click of a button.

    Thing is the previous view state of the controls is not kept each time
    the button is clicked. A for loop is used to build each row and
    increment the control ID's.

    I've tried several fix suggestions from this NG such as IsNotPostBack
    and adding the control properties after adding the control to the
    placeholder but still no joy.

    Every time the button is clicked the previous dropdowns revert to the
    first in the list, the text boxs goes blank and reverts to a default
    size and the radio buttons goes blank.

    Im losing it. Please help

    Kevin
    Dstl Web Team, Jan 9, 2004
    #1
    1. Advertising

  2. Hey Kevin,

    Dynamically-added controls aren't persisted, so you have to recreate them on
    each request.

    It sounds like you need this free tool to handle that for you:

    DynamicControlsPlaceholder

    http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx

    Ken

    "Dstl Web Team" <> wrote in message
    news:3ffe97b3.6624859@146.80.9.44...
    > Hi,
    >
    > I am using the placeholder to dynamically create a new row in a table
    > that contains a dropdown list, a text box an a radio button on the
    > click of a button.
    >
    > Thing is the previous view state of the controls is not kept each time
    > the button is clicked. A for loop is used to build each row and
    > increment the control ID's.
    >
    > I've tried several fix suggestions from this NG such as IsNotPostBack
    > and adding the control properties after adding the control to the
    > placeholder but still no joy.
    >
    > Every time the button is clicked the previous dropdowns revert to the
    > first in the list, the text boxs goes blank and reverts to a default
    > size and the radio buttons goes blank.
    >
    > Im losing it. Please help
    >
    > Kevin
    Ken Cox [Microsoft MVP], Jan 10, 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. john
    Replies:
    4
    Views:
    5,021
    Curt_C [MVP]
    Jan 30, 2004
  2. Kevin C
    Replies:
    1
    Views:
    2,281
    Kevin C
    Oct 20, 2004
  3. =?Utf-8?B?R3JpZ3M=?=

    C# - Dynamically Creating Table - Losing ViewState

    =?Utf-8?B?R3JpZ3M=?=, Nov 19, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    10,557
    =?Utf-8?B?R3JpZ3M=?=
    Nov 19, 2004
  4. Replies:
    0
    Views:
    623
  5. Jason C
    Replies:
    4
    Views:
    683
    Morty Abzug
    Jun 26, 2012
Loading...

Share This Page