473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Reading The Selected Value In DropDown List

Do you have to use AutoPostBack to read the selected value in a dropdown
list? I have an asp.net dropdown on a form. I'm filling it from a table
when the page loads and want to read the value the user selected when they
submit the entire form. But regardless of the value they select, I always
get the first item in the list when I read it. I can get the values from
the text boxes without a problem. But the dropdown list seems to work
differently. What am I doing wrong? Thanks.

Jerry
Dec 14 '05 #1
6 3071
Jerry,

No, you don't have to use AutoPostBack property. Rather check if you are
using IsPostBack property in the PageLoad event.

Eliyahu

<rl*****@newsgroups.nospam> wrote in message
news:uj**************@TK2MSFTNGP15.phx.gbl...
Do you have to use AutoPostBack to read the selected value in a dropdown
list? I have an asp.net dropdown on a form. I'm filling it from a table
when the page loads and want to read the value the user selected when they
submit the entire form. But regardless of the value they select, I always
get the first item in the list when I read it. I can get the values from
the text boxes without a problem. But the dropdown list seems to work
differently. What am I doing wrong? Thanks.

Jerry

Dec 14 '05 #2
Joe
Jerry,

Please post your code. I'm dealing with a similar issue.

Thanks,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"rl*****@newsgroups.nospam" wrote:
Do you have to use AutoPostBack to read the selected value in a dropdown
list? I have an asp.net dropdown on a form. I'm filling it from a table
when the page loads and want to read the value the user selected when they
submit the entire form. But regardless of the value they select, I always
get the first item in the list when I read it. I can get the values from
the text boxes without a problem. But the dropdown list seems to work
differently. What am I doing wrong? Thanks.

Jerry

Dec 14 '05 #3
Make sure you are not repopulating the drop down list on postback. This will
force you to get the first item in the list.

<rl*****@newsgroups.nospam> wrote in message
news:uj**************@TK2MSFTNGP15.phx.gbl...
Do you have to use AutoPostBack to read the selected value in a dropdown
list? I have an asp.net dropdown on a form. I'm filling it from a table
when the page loads and want to read the value the user selected when they
submit the entire form. But regardless of the value they select, I always
get the first item in the list when I read it. I can get the values from
the text boxes without a problem. But the dropdown list seems to work
differently. What am I doing wrong? Thanks.

Jerry

Dec 14 '05 #4
That was the issue... I had entered the call below my IsPostBack block...

Thanks!
"Morgan" <ab**@senditon.com> wrote in message
news:u$**************@TK2MSFTNGP14.phx.gbl...
Make sure you are not repopulating the drop down list on postback. This will force you to get the first item in the list.

<rl*****@newsgroups.nospam> wrote in message
news:uj**************@TK2MSFTNGP15.phx.gbl...
Do you have to use AutoPostBack to read the selected value in a dropdown
list? I have an asp.net dropdown on a form. I'm filling it from a table when the page loads and want to read the value the user selected when they submit the entire form. But regardless of the value they select, I always get the first item in the list when I read it. I can get the values from the text boxes without a problem. But the dropdown list seems to work
differently. What am I doing wrong? Thanks.

Jerry


Dec 14 '05 #5
I had an issue today similar to this; but my issue was the the value
property for each of the list items was not unique. To keep the
selection after postback the value property MUST be unique.

Dec 14 '05 #6

Hey
Why dont u make use of the ViewState of the control property to reset the
selected value

Rajesh

"tdavisjr" <td******@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I had an issue today similar to this; but my issue was the the value
property for each of the list items was not unique. To keep the
selection after postback the value property MUST be unique.

Jan 8 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Kris Rockwell | last post by:
Hello (again), I have gotten the dropdown list functionality to work through a few tricks (probably not the most efficient, but it works) but I am not sure how to set the default selected value....
3
by: Celine | last post by:
I have a webform with multiple panels with textboxes, dropdownlists, radiobuttonlists, etc. The user navigates through the panels and then submits the information at the end. The first panel...
6
by: Jenna Alten | last post by:
I have a datagrid with a template column that contains a dropdown list. I currently fill and display the dropdown list on the page load. This is working correctly. I am NOT using an Edit Column. I...
1
by: Ben | last post by:
I have a formview with a few dropdownlists (software version, database version, etc). When a software version is selected, the database version dropdownlist updates itself accordingly. When in...
1
by: CorporateCoder | last post by:
Hi, I am trying to bind the selected value of a databound dropdown box in a databound gridview control to the value being displayed in the template column the dropdown box has been added to. ...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
6
by: itgaurav198 | last post by:
Hi, i have one jsp in which i select a value from drop down and on change of this a servlet is called that accesses some values and return to the same jsp where these values get populated in...
16
by: tarunkhatri | last post by:
Hi. I have a javascript function to change the value of the cell on chnage event of a dropdown list.My code is workin but the problem is that the value of the cell is chaning but not respective to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.