AJAX TabContainer - losing ListBox data on postback

Discussion in 'ASP .Net' started by Mel, Oct 23, 2008.

  1. Mel

    Mel Guest

    On a tab I have one DropDownList which requires a postback and two
    ListBoxes which do not require any postback because I just have some
    javascript, defined in the aspx file, to copy items from one listbox
    to the other. All 3 of these controls exist in a table which is
    inside an UpdatePanel. When the drop down list value changes and the
    postback occurs the data that I had in my listbox control disappears.
    How do I fix this?

    (using: asp.net 2.0, vb.net, visual studio 2005, winxp pro sp2)
     
    Mel, Oct 23, 2008
    #1
    1. Advertising

  2. Mel

    bruce barker Guest

    the browser only sends back the selected value to the server. if
    javascript adds a new value, when the postback is processed on the
    server, the server side DropDownList has no matching item to select.

    in oninit you need to add code on the server side that adds the new
    value to the DropDownList. you could look in the form collection for the
    value.

    -- bruce (sqlwork.com)

    Mel wrote:
    > On a tab I have one DropDownList which requires a postback and two
    > ListBoxes which do not require any postback because I just have some
    > javascript, defined in the aspx file, to copy items from one listbox
    > to the other. All 3 of these controls exist in a table which is
    > inside an UpdatePanel. When the drop down list value changes and the
    > postback occurs the data that I had in my listbox control disappears.
    > How do I fix this?
    >
    > (using: asp.net 2.0, vb.net, visual studio 2005, winxp pro sp2)
     
    bruce barker, Oct 23, 2008
    #2
    1. Advertising

  3. Mel

    Mel Guest

    On Oct 23, 8:30 am, bruce barker <> wrote:
    > the browser only sends back the selected value to the server. if
    > javascript adds a new value, when the postback is processed on the
    > server, the server side DropDownList has no matching item to select.
    >
    > in oninit you need to add code on the server side that adds the new
    > value to the DropDownList. you could look in the form collection for the
    > value.
    >
    > -- bruce (sqlwork.com)
    >
    > Mel wrote:
    > > On a tab I have one DropDownList which requires a postback and two
    > > ListBoxes which do not require any postback because I just have some
    > > javascript, defined in the aspx file, to copy items from one listbox
    > > to the other.  All 3 of these controls exist in a table which is
    > > inside an UpdatePanel.  When the drop down list value changes and the
    > > postback occurs the data that I had in my listbox control disappears.
    > > How do I fix this?

    >
    > > (using: asp.net 2.0, vb.net, visual studio 2005, winxp pro sp2)


    I don't understand what you mean...
     
    Mel, Oct 23, 2008
    #3
  4. Mel

    Mel Guest

    On Oct 23, 10:22 am, Mel <> wrote:
    > On Oct 23, 8:30 am, bruce barker <> wrote:
    >
    >
    >
    > > the browser only sends back the selected value to the server. if
    > > javascript adds a new value, when the postback is processed on the
    > > server, the server side DropDownList has no matching item to select.

    >
    > > in oninit you need to add code on the server side that adds the new
    > > value to the DropDownList. you could look in the form collection for the
    > > value.

    >
    > > -- bruce (sqlwork.com)

    >
    > > Mel wrote:
    > > > On a tab I have one DropDownList which requires a postback and two
    > > > ListBoxes which do not require any postback because I just have some
    > > > javascript, defined in the aspx file, to copy items from one listbox
    > > > to the other.  All 3 of these controls exist in a table which is
    > > > inside an UpdatePanel.  When the drop down list value changes and the
    > > > postback occurs the data that I had in my listbox control disappears.
    > > > How do I fix this?

    >
    > > > (using: asp.net 2.0, vb.net, visual studio 2005, winxp pro sp2)

    >
    > I don't understand what you mean...


    I figured it out. When I copy, move position, or delete an item from
    the listbox I call a Get_Item_List function in Javascript to store all
    of the items to a hidden field. Then on page_load of the form if the
    hidden field has a value I update the list box with the items I have
    stored in the hidden field.
     
    Mel, Oct 23, 2008
    #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. smnbss

    AJAX TabContainer TabPanel Repeater

    smnbss, Apr 2, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    815
    smnbss
    Apr 2, 2007
  2. =?Utf-8?B?QW5kcmV3?=

    AJAX TabContainer Problem

    =?Utf-8?B?QW5kcmV3?=, Sep 27, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    419
    =?Utf-8?B?QW5kcmV3?=
    Sep 27, 2007
  3. Replies:
    1
    Views:
    473
  4. Colorstone
    Replies:
    2
    Views:
    2,842
    Colorstone
    Oct 7, 2008
  5. Mel
    Replies:
    0
    Views:
    840
Loading...

Share This Page