Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop Down List Value

Status
Not open for further replies.

Jim318

Programmer
Jul 1, 2002
33
US
Hello,

I have a drop down list that reads its items from a database. Once the drop down list value is changed it is fine until the user goes to save the record, then the list value reverts back to the first selection in the drop down box.

Thanks in advanced for any help!

Jim
 
You need to post the code. Sounds to me like your doing the databinding for the drop down at every page load, when you should only be doing it if not page.ispostback

Mark [openup]
 
Mark,

You are right. I am doing the data binding for every page load.

A quick snipet of what I was doing is
adocon.Open()
lstreq.DataSource = Cmd.ExecuteReader
lstreq.DataMember = "Requesters"
lstreq.DataTextField = "Name"
lstreq.DataValueField = "Name"
lstreq.DataBind()
adocon.Close()

Thanks,
Jim
 
Well, I don't know if you figured this out from your reply, but if you put that code inside a

If not page.ispostback then
...your code
end if

it should solve the problem, I think.



Mark [openup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top