Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3484030
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:44:32+00:00 2026-05-18T10:44:32+00:00

Okay, so I have a DropDownList control that contains 50 ListItems, one for each

  • 0

Okay, so I have a DropDownList control that contains 50 ListItems, one for each of the 50 states. The text value reflects each state name which makes each text value unique. However, the value property of each list item contains that state’s current tax rate, which means that some of the values are not unique. Postbacks on this control constantly change the selected item. Is there a work around for this?

To duplicate, copy the code below into a new web form. It is just a simple DropDownList. Try selecting different states. Some of them stick, and others do not. For instance, try selecting “Idaho” as the state; it reverts to Arkansas for some reason. This is happening before the OnSelectedIndexChanged event even fires because if I select “Idaho” and then read the selected item in the event method on postback, the selected item is Arkansas! Very annoying.

            State:<br />
            <asp:DropDownList BorderWidth="3px" AutoPostBack="true" BackColor="#ffffcc" ID="ddlBillingState"
                runat="server">
                <asp:ListItem Value="0" Text="Not Specified"></asp:ListItem>
                <asp:ListItem Value="4" Text="Alabama"></asp:ListItem>
                <asp:ListItem Value="0" Text="Alaska"></asp:ListItem>
                <asp:ListItem Value="5.6" Text="Arizona"></asp:ListItem>
                <asp:ListItem Value="6" Text="Arkansas"></asp:ListItem>
                <asp:ListItem Value="8.25" Text="California"></asp:ListItem>
                <asp:ListItem Value="2.9" Text="Colorado"></asp:ListItem>
                <asp:ListItem Value="6" Text="Connecticut"></asp:ListItem>
                <asp:ListItem Value="6" Text="District of Columbia"></asp:ListItem>
                <asp:ListItem Value="0" Text="Delaware"></asp:ListItem>
                <asp:ListItem Value="6" Text="Florida"></asp:ListItem>
                <asp:ListItem Value="4" Text="Georgia"></asp:ListItem>
                <asp:ListItem Value="4" Text="Hawaii"></asp:ListItem>
                <asp:ListItem Value="6" Text="Idaho"></asp:ListItem>
                <asp:ListItem Value="6.25" Text="Illinois"></asp:ListItem>
                <asp:ListItem Value="7" Text="Indiana"></asp:ListItem>
                <asp:ListItem Value="6" Text="Iowa"></asp:ListItem>
                <asp:ListItem Value="5.3" Text="Kansas"></asp:ListItem>
                <asp:ListItem Value="6" Text="Kentucky"></asp:ListItem>
                <asp:ListItem Value="4" Text="Louisiana"></asp:ListItem>
                <asp:ListItem Value="5" Text="Maine"></asp:ListItem>
                <asp:ListItem Value="6" Text="Maryland"></asp:ListItem>
                <asp:ListItem Value="6.25" Text="Massachusetts"></asp:ListItem>
                <asp:ListItem Value="6" Text="Michigan"></asp:ListItem>
                <asp:ListItem Value="6.875" Text="Minnesota"></asp:ListItem>
                <asp:ListItem Value="7" Text="Mississippi"></asp:ListItem>
                <asp:ListItem Value="4.225" Text="Missouri"></asp:ListItem>
                <asp:ListItem Value="0" Text="Montana"></asp:ListItem>
                <asp:ListItem Value="5.5" Text="Nebraska"></asp:ListItem>
                <asp:ListItem Value="6.85" Text="Nevada"></asp:ListItem>
                <asp:ListItem Value="0" Text="New Hampshire"></asp:ListItem>
                <asp:ListItem Value="7" Text="New Jersey"></asp:ListItem>
                <asp:ListItem Value="5" Text="New Mexico"></asp:ListItem>
                <asp:ListItem Value="4" Text="New York"></asp:ListItem>
                <asp:ListItem Value="5.75" Text="North Carolina"></asp:ListItem>
                <asp:ListItem Value="5" Text="North Dakota"></asp:ListItem>
                <asp:ListItem Value="5.5" Text="Ohio"></asp:ListItem>
                <asp:ListItem Value="4.5" Text="Oklahoma"></asp:ListItem>
                <asp:ListItem Value="0" Text="Oregon"></asp:ListItem>
                <asp:ListItem Value="6" Text="Pennsylvania"></asp:ListItem>
                <asp:ListItem Value="7" Text="Rhode Island"></asp:ListItem>
                <asp:ListItem Value="6" Text="South Carolina"></asp:ListItem>
                <asp:ListItem Value="4" Text="South Dakota"></asp:ListItem>
                <asp:ListItem Value="7" Text="Tennessee"></asp:ListItem>
                <asp:ListItem Value="6.25" Text="Texas"></asp:ListItem>
                <asp:ListItem Value="4.7" Text="Utah"></asp:ListItem>
                <asp:ListItem Value="6" Text="Vermont"></asp:ListItem>
                <asp:ListItem Value="5.0" Text="Virginia"></asp:ListItem>
                <asp:ListItem Value="6.5" Text="Washington"></asp:ListItem>
                <asp:ListItem Value="6" Text="West Virginia"></asp:ListItem>
                <asp:ListItem Value="5" Text="Wisconsin"></asp:ListItem>
                <asp:ListItem Value="4" Text="Wyoming"></asp:ListItem>
            </asp:DropDownList>

I even tried disabling viewstate, then OnSelectedIndexChanged I would store the selected index in ViewState[“selectedIndex”] and retrieve it on postback and repopulate the drop down list. But as I said before, because the selected item is a different value than the one intended before it even gets to the event, it was just storing the screwy value in my custom viewstate field.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:44:33+00:00Added an answer on May 18, 2026 at 10:44 am

    I think your values should be unique. Instead of putting the tax rate as the value, instead let the value simply be the state, and then use that state to obtain your tax value. As one example, in your code-behind, you could have a Dictionary<string, decimal> taxTable that you use to get your values. Such as

    decimal taxRate = taxTable[yourDropDown.SelectedValue];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I have three tables that all communicate with each other. ForumTopic t ForumMessage
Okay, I have this program and I don't want more than one instance of
Okay I have a large CRUD app that uses tabs with Forms embedded in
Okay I have my csv builder essentially working. it has 3 columns. Name, Position,
Okay so what I have is a table that keeps track of history on
Okay I have this RewriteRule which is supposed to redirect any request for the
Okay so I have the following Code which appends a string to another in
Okay so I have a scenario similar to the below code, I have a
I have the following arrays in PHP (okay they are a bit bigger but
Okay here's the program I have typed up(stdio.h is included also): /* function main

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.