Problem with Autopostback

Discussion in 'ASP .Net Building Controls' started by mo, Oct 22, 2004.

  1. mo

    mo Guest

    Hi,

    I have a set of Dynamic DropDownLists with AutoPostback. the problem I
    have is that when I select the dropdown and the page refreshes the old
    values in the text boxes disappear. Is there a way to preserve the
    values?

    Thanks,
    Mo
    mo, Oct 22, 2004
    #1
    1. Advertising

  2. mo

    Jorge Matos Guest

    Make sure you are not accidentally re-initializing your controls. All
    controls have viewstate to maintain their values, and therefore in your
    Page_Load event you need to make sure you only initialize your drop-downs
    when the page is first being requested via HTTP GET request and not during an
    HTTP POST request.

    inside Page_Load:

    public void Page_Load(object sender, EventArgs e)
    {
    if (!Page.IsPostBack)
    {
    //Initialize drop downs here
    }
    }

    "mo" wrote:

    > Hi,
    >
    > I have a set of Dynamic DropDownLists with AutoPostback. the problem I
    > have is that when I select the dropdown and the page refreshes the old
    > values in the text boxes disappear. Is there a way to preserve the
    > values?
    >
    > Thanks,
    > Mo
    >
    Jorge Matos, Oct 22, 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. Jesse

    Problem with Autopostback

    Jesse, Jul 17, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    455
    Jesse
    Jul 17, 2003
  2. Lloyd Sheen
    Replies:
    3
    Views:
    4,742
  3. Sean  Chapman

    Problem with autopostback on webcontrols

    Sean Chapman, Jan 20, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,884
  4. Darcy810
    Replies:
    0
    Views:
    1,466
    Darcy810
    Feb 15, 2006
  5. Replies:
    1
    Views:
    11,597
    S. Justin Gengo
    Mar 31, 2006
Loading...

Share This Page