?
Solved

My dropdownlist box is returing the same value no matter what is selected

Posted on 2008-10-06
6
Medium Priority
?
211 Views
Last Modified: 2012-05-05
No matter what I select my dropdownlist box is posting the value of the first option.

Here is the drop down box

 <asp:DropDownList ID="locationDropDown" runat="server"
           
           
            style="top: 300px; left: 400px; position: absolute; height: 13px; width: 139px"
            DataSourceID="ds" DataTextField="description"
            DataValueField="pkey"
         
        >
           
        </asp:DropDownList>


here is the event that is triggered and passes the value to the next page.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
         Context.Items.Add("requestor", requestorTextBox.Text)
         Context.Items.Add("supplier", supplierTextBox.Text)
         Context.Items.Add("location", locationDropDown.SelectedValue)
         Context.Items.Add("csRep", csRepDropDown.SelectedValue)
         Server.Transfer("poResults.aspx")
         requestorLabel.Text = locationDropDown.SelectedValue
     End Sub

Here is the catching code on the page load event of the page sumitted to


 Label1.Text = Context.Items("csRep")
0
Comment
Question by:soccerman777
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 21

Expert Comment

by:silemone
ID: 22653888
Are all of the dropdowns doing this...I noticed you had more than one, or just this one?
0
 
LVL 21

Assisted Solution

by:silemone
silemone earned 400 total points
ID: 22653901
try AutoPostBack = true and see what happens...It will produce a refresh but I want to see if it will change then...
0
 

Author Comment

by:soccerman777
ID: 22653964
Yes both drop downs are doing it. I have already tried setting the auto post back property.  Also if I set an event of a change of the drop down it will not work either.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:rlh68
ID: 22653989

What does the source HTML for the drop down in question look like?
0
 

Author Comment

by:soccerman777
ID: 22654040
<select name="locationDropDown" onchange="__doPostBack('locationDropDown','')" language="javascript" id="locationDropDown" DataSourceID="ds" style="top: 300px; left: 400px; position: absolute; height: 13px; width: 139px">
      <option selected="selected" value="100001">Oklahoma City CSC</option>
      <option value="100002">Tulsa CSC</option>
      <option value="100003">Amarillo CSC</option>
      <option value="100004">Wichita CSC</option>
      <option value="100005">Dallas/Ft. Worth CSC</option>
      <option value="100006">Houston CSC</option>
      <option value="100007">San Antonio CSC</option>
      <option value="100008">Abilene CSC</option>
      <option value="100009">Beaumont CSC</option>
      <option value="100010">El Paso CSC</option>
      <option value="100011">Odessa  CSC</option>
      <option value="100012">Albuquerque CSC</option>
      <option value="100013">Phoenix CSC</option>
      <option value="100014">Shreveport CSC</option>

</select>
0
 
LVL 11

Accepted Solution

by:
Salim Fayad earned 1600 total points
ID: 22654077
Where is the code that binds the dropdownlist? Is it on the Page_Load event? If so, make sure to put it inside an Not IsPostBack if condition
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question