ASP.Net: State and Country Dropdown lists

Thank god for the great Interweb! These two pages saved me a lot of time typing out the full controls for state and country dropdown lists. It’s as easy as copy and paste.

Country Dropdown:

State Dropdown:

And here is my version that includes the Canadian provinces and territories:

<asp:DropDownList id=”UserState” runat=”server”>
<asp:ListItem Value=”” Selected=”true”>Select State / Province</asp:ListItem>
<asp:ListItem Value=””>—- US States —-</asp:ListItem>
<asp:ListItem Value=”AL”>Alabama</asp:ListItem>
<asp:ListItem Value=”AK”>Alaska</asp:ListItem>
<asp:ListItem Value=”AZ”>Arizona</asp:ListItem>
<asp:ListItem Value=”AR”>Arkansas</asp:ListItem>
<asp:ListItem Value=”CA”>California</asp:ListItem>
<asp:ListItem Value=”CO”>Colorado</asp:ListItem>
<asp:ListItem Value=”CT”>Connecticut</asp:ListItem>
<asp:ListItem Value=”DC”>District of Columbia</asp:ListItem>
<asp:ListItem Value=”DE”>Delaware</asp:ListItem>
<asp:ListItem Value=”FL”>Florida</asp:ListItem>
<asp:ListItem Value=”GA”>Georgia</asp:ListItem>
<asp:ListItem Value=”HI”>Hawaii</asp:ListItem>
<asp:ListItem Value=”ID”>Idaho</asp:ListItem>
<asp:ListItem Value=”IL”>Illinois</asp:ListItem>
<asp:ListItem Value=”IN”>Indiana</asp:ListItem>
<asp:ListItem Value=”IA”>Iowa</asp:ListItem>
<asp:ListItem Value=”KS”>Kansas</asp:ListItem>
<asp:ListItem Value=”KY”>Kentucky</asp:ListItem>
<asp:ListItem Value=”LA”>Louisiana</asp:ListItem>
<asp:ListItem Value=”ME”>Maine</asp:ListItem>
<asp:ListItem Value=”MD”>Maryland</asp:ListItem>
<asp:ListItem Value=”MA”>Massachusetts</asp:ListItem>
<asp:ListItem Value=”MI”>Michigan</asp:ListItem>
<asp:ListItem Value=”MN”>Minnesota</asp:ListItem>
<asp:ListItem Value=”MS”>Mississippi</asp:ListItem>
<asp:ListItem Value=”MO”>Missouri</asp:ListItem>
<asp:ListItem Value=”MT”>Montana</asp:ListItem>
<asp:ListItem Value=”NE”>Nebraska</asp:ListItem>
<asp:ListItem Value=”NV”>Nevada</asp:ListItem>
<asp:ListItem Value=”NH”>New Hampshire</asp:ListItem>
<asp:ListItem Value=”NJ”>New Jersey</asp:ListItem>
<asp:ListItem Value=”NM”>New Mexico</asp:ListItem>
<asp:ListItem Value=”NY”>New York</asp:ListItem>
<asp:ListItem Value=”NC”>North Carolina</asp:ListItem>
<asp:ListItem Value=”ND”>North Dakota</asp:ListItem>
<asp:ListItem Value=”OH”>Ohio</asp:ListItem>
<asp:ListItem Value=”OK”>Oklahoma</asp:ListItem>
<asp:ListItem Value=”OR”>Oregon</asp:ListItem>
<asp:ListItem Value=”PA”>Pennsylvania</asp:ListItem>
<asp:ListItem Value=”RI”>Rhode Island</asp:ListItem>
<asp:ListItem Value=”SC”>South Carolina</asp:ListItem>
<asp:ListItem Value=”SD”>South Dakota</asp:ListItem>
<asp:ListItem Value=”TN”>Tennessee</asp:ListItem>
<asp:ListItem Value=”TX”>Texas</asp:ListItem>
<asp:ListItem Value=”UT”>Utah</asp:ListItem>
<asp:ListItem Value=”VT”>Vermont</asp:ListItem>
<asp:ListItem Value=”VA”>Virginia</asp:ListItem>
<asp:ListItem Value=”WA”>Washington</asp:ListItem>
<asp:ListItem Value=”WV”>West Virginia</asp:ListItem>
<asp:ListItem Value=”WI”>Wisconsin</asp:ListItem>
<asp:ListItem Value=”WY”>Wyoming</asp:ListItem>
<asp:ListItem Value=””>—- Canadian Provinces —-</asp:ListItem>
<asp:ListItem Value=”AB”>Alberta</asp:ListItem>
<asp:ListItem Value=”BC”>British Columbia</asp:ListItem>
<asp:ListItem Value=”MB”>Manitoba</asp:ListItem>
<asp:ListItem Value=”NB”>New Brunswick</asp:ListItem>
<asp:ListItem Value=”NL”>Newfoundland and Labrador</asp:ListItem>
<asp:ListItem Value=”NT”>Northwest Territories</asp:ListItem>
<asp:ListItem Value=”NS”>Nova Scotia</asp:ListItem>
<asp:ListItem Value=”NU”>Nunavut</asp:ListItem>
<asp:ListItem Value=”ON”>Ontario</asp:ListItem>
<asp:ListItem Value=”PE”>Prince Edward Island</asp:ListItem>
<asp:ListItem Value=”QC”>Quebec</asp:ListItem>
<asp:ListItem Value=”SK”>Saskatchewan</asp:ListItem>
<asp:ListItem Value=”YT”>Yukon</asp:ListItem>
</asp:DropDownList>

Advertisements

2 Responses to ASP.Net: State and Country Dropdown lists

  1. Alicia says:

    Yay! Thank you!

  2. Darian says:

    Thanks a billion and a half!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: