Hi,

I have a aspx form on which I have a ListBox control a text field a button (btnA) and a submit button (btnB). The scenario is: the user enters text in the text field and clicks btnA. The value in the text field is added as an option in the list box.
When the user clicks btnB, the form is posted back and I retrieve and store the items in the ListBox in database.

This was working fine untill I was adding values to listbox on server side i.e. after a postback. But due to some requirements by the client, we do not want a post back on btnA click but want to add those values using javascript.

I did that but now the values in the listbox are not available on server even though it is populated.

Can anybody help me in this regard please?

Thanks,
H

Solved. Used a hidden formfield and populated it on the clientside with listbox contents. It's a work around. Still looking for a proper solution.

I think You cannot get the value from the server control if you fill the value in the server control on the client side, because before posting the page from server side to the browser asp.net save the viewstate and in this case your listbox was empty when it is rendring firsttime. In this case you only fill the listbox on clientside not changed its(listbox) viewstate which was empty. so after postback asp.net do not find your value.

This question has already been answered. Start a new discussion instead.