Dropdown is maintaining itz state after postback

G

Guest

Hi,
Currently iam facing a strange problem.. One dropdown in my page is
keeping itz state after postback. Whichever the item i selected is not the
selected item after postback. it goes back to the first item again. This
happens even if i submitted the page by making the AutoPostback of the
dropdown true or by clicking on the submit button. Even itz not going to the
DropDownList1_SelectedIndexChanged method.

A checking is already there at page load event to avoid filling the dropdown
at the time of postback.

The items are populating from database. The intresting matter is, this
problem comes only when i fill the dropdown from the database. if iam
hardcoding the items then this problem is not there. That time itz
maintaining the state.

Anybody hav any idea what may be the problem
 
B

Brock Allen

It sounds like you're always repopulating the DropDownList in Page_Load (or
whereever you're accessing the database). Try to only populate the DropDownList
the first request in, so check !IsPostBack.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top