StatesDropDownList Control
The StatesDropDownList is simply a convenience for all those times when you need to create forms allowing the user to select a state. It inherits from the standard DropDownList and is for the most part used in the same way (other than the fact that you will probably rarely want to add any ListItems!).

The following tags were used to create the examples above:

Properties & Methods
StatesDropDownListThe StatesDropDownList is a simple convenience control that inherits from the standard DropDownList and is used for selecting a state. Most properties inherited from System.Web.UI.WebControls.DropDownList are not listed here, but are available.
  • StatesFormatString - The format used to list the states in the generated DropDownList. The format string uses standard formatstring syntax, with {0} representing the abbreviated state name and {1} representing the full state name
  • StatesFormat - One of the predefined formatstrings from the StatesDisplayStyle enumeration, default is Abbreviation
  • DisplayDC - Specifies whether or not District of Columbia/DC should be included in the list of states, default is True
  • DisplayBlank - Specifies whether or not to include an extra ListItem at the beginning of the list, default is True
  • BlankText - The text to be used for the first ListItem if DisplayBlank is set to True, default is String.Empty
  • SelectedValue (inherited from DropDownList) - The value of the selected item. This will be the state abbreviation in capital letters or String.Empty if DisplayBlank is set to True and is selected
StatesDisplayStyle As ByteAn enumeration used to specify the formatstring used to select a predefined formatstring for the StatesFormat property. If you wish to specify a custom formatstring you must select StatesDisplayStyle.Custom.
  • Abbreviation - Displays only the state abbreviation
  • AbbreviationName - Displays the state abbreviation followed by a dash and the state name, equivelant to using StatesFormatString="{0} - {1}"
  • Custom - Uses the formatstring specified in StatesFormatString, which uses {0} to represent the state abbreviation and {1} to represent the state name
  • Name - Displays only the state name
  • NameAbbreviation - Displays the state name followed by a space and the state abbreviation in parentheses, equivelant to using StatesFormatString="{1} ({0})"
Source Code

Because StatesDropDownList overrides the RenderContents method, it may not function as expected if you declaratively add ListItems using the <asp:ListItem/> tag. If you wish to add any ListItems other than the ones I have made available, I suggest that you either modify my code (which you are more than welcome to do) or write your own control. If there is an option you think should be included, feel free to send it to me and I will take it into consideration.