Microsoft Developer
Microsoft Developer

Reputation: 5459

How to access value of list box?

I have update panel which gets updated on button click event. Out of the update panel,there is list box. When user clicks on the button which is placed inside update panel, at that time I want to retrieve selected items from the list box, but when I click the button, the selected index of list box is showing zero even if I select any item. I cant understand why it is happening so. Perhaps it is because partial update is taking place. How to tackel with this problem??

Upvotes: 1

Views: 208

Answers (1)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

When you click the button, your page does a postback to the server on page_load and I think you are binding again. That's why the previous selection cleared. You should take care of the IsPostBack Condition while binding data to the listbox.

Upvotes: 2

Related Questions