By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,550 Members | 908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,550 IT Pros & Developers. It's quick & easy.

DropDownList always returns value at index 0

P: n/a
I have a form that contains a DropDownList. When I submit the form and
attempt to use the DropDownList's value (I am doing this by using the
..SelectedValue property), I always recieve the value at index 0. What could
be causing this? Any help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Nathan Sokalski" <nj********@hotmail.com> wrote in
news:eS**************@TK2MSFTNGP14.phx.gbl:
I have a form that contains a DropDownList. When I submit the form and
attempt to use the DropDownList's value (I am doing this by using the
.SelectedValue property), I always recieve the value at index 0. What
could be causing this? Any help would be appreciated. Thanks.


Are you rebinding the drop down on each postback?
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
Nov 21 '05 #2

P: n/a
Possibly you are filling the dropdown on postback also. Check it is done
only on initial page load:

If (Not PostBack) Then
// Fill drop-down
End If

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:eS**************@TK2MSFTNGP14.phx.gbl...
I have a form that contains a DropDownList. When I submit the form and
attempt to use the DropDownList's value (I am doing this by using the
..SelectedValue property), I always recieve the value at index 0. What could
be causing this? Any help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 21 '05 #3

P: n/a
Nathan,

How did you fill your dropdownlist.
If that is by a datasource, did you than restore your datasource at PostBack
time?

\\\
If Not IsPostBack then
fill ds
Session.Item(ds) = ds
Else
ds = Session.Item(ds)
End if
////

And don't forget to databind it at the last instruction before your sent
back

I hope this helps,

Cor
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.