Dropdownlist "selected" item

S

Steve Lloyd

Hi,

I am using a dropdown list in a webform, when the postback is done the
selected property in the <option> is set to an item in the list that was not
selected before the postback.

Has anyone seen this before and do you have a fix for it

Thanks

Steve
 
A

Alvin Bruney [MVP]

first try deleting the control and adding it back. If this doesn't help,
post your page load code and the code tied to the dropdown postback if any.
 
C

CMA

hi Steve,

most probably u r creating the control items in each post back round trip to
the server...
pls read on "IsPostBack" in ASP.NET...
u can easily fix it.

try to put a break point in the page load and see whether the create items
section is execute all the time.

u can use like this..

if(!IsPostBack)
{
// assign items here. so it will create only once. not in the post back
round trips..
}

hope this helps,
CMA
 

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
474,099
Messages
2,570,626
Members
47,237
Latest member
David123

Latest Threads

Top