AJAX TabContainer - losing ListBox data on postback

  • Thread starter Thread starter Mel
  • Start date Start date
M

Mel

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)
 
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)
 
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)

I don't understand what you mean...
 
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.
 
Back
Top