I have what I need to work except I want to make it more user-friendly. The states that get dynamically pulled into my dropdown list show up fine, but I would like the states to be fully spelled out. For example. instead of 'AL', I want Alabama. The database I pulling from only has state abbreviations. I'm not sure how to alter the state data before binding to my dropdown list. Any help will be appreciated. Thanks!
Here's my code:
using (SqlConnection con = new SqlConnection(CS))
{
SqlCommand cmd = new SqlCommand("SELECT * FROM[MYTABLE] WHERE([UPN] LIKE '%' + @UPN + '%')", con);
cmd.Parameters.AddWithValue("UPN", UPNCode);
con.Open();
DropDownList2.DataSource = cmd.ExecuteReader();
DropDownList2.DataTextField = "State";
DropDownList2.DataValueField = "State";
DropDownList2.DataBind();
DropDownList2.Items.Insert(0, new ListItem("Select your state", ""));
}