Microsoft
Software
Hardware
Network
Question : asp.net How to bind a state dropdownlist?
I have this TextBox that I want to replace with dropdownlist
. <asp:TextBox ID="State" Width="80" runat="server" Text='<%# Bind("State") %>'></asp:TextBox>
But how do I bind the value selected to the State selected?
<asp:DropDownList ID="DropDownList2" runat="server" >
<asp:ListItem Value="AK">Alaska</asp:Lis
tItem>
<asp:ListItem Value="AL">Alabama</asp:Li
stItem>
<asp:ListItem Value="AR">Arkansas</asp:L
istItem>
<asp:ListItem Value="AZ">Arizona</asp:Li
stItem>
<asp:ListItem Value="CA">California</asp
:ListItem>
<asp:ListItem Value="CO">Colorado</asp:L
istItem>
<asp:ListItem Value="CT">Connecticut</as
p:ListItem
>
<asp:ListItem Value="DC">District of Columbia</asp:ListItem>
<asp:ListItem Value="DE">Delaware</asp:L
istItem>
<asp:ListItem Value="FL">Florida</asp:Li
stItem>
<asp:ListItem Value="GA">Georgia</asp:Li
stItem>
<asp:ListItem Value="HI">Hawaii</asp:Lis
tItem>
<asp:ListItem Value="IA">Iowa</asp:ListI
tem>
<asp:ListItem Value="ID">Idaho</asp:List
Item>
<asp:ListItem Value="IL">Illinois</asp:L
istItem>
<asp:ListItem Value="IN">Indiana</asp:Li
stItem>
<asp:ListItem Value="KS">Kansas</asp:Lis
tItem>
<asp:ListItem Value="KY">Kentucky</asp:L
istItem>
<asp:ListItem Value="LA">Louisiana</asp:
ListItem>
<asp:ListItem Value="MA">Massachusetts</
asp:ListIt
em>
<asp:ListItem Value="MD">Maryland</asp:L
istItem>
<asp:ListItem Value="ME">Maine</asp:List
Item>
<asp:ListItem Value="MI">Michigan</asp:L
istItem>
<asp:ListItem Value="MN">Minnesota</asp:
ListItem>
<asp:ListItem Value="MO">Missouri</asp:L
istItem>
<asp:ListItem Value="MS">Mississippi</as
p:ListItem
>
<asp:ListItem Value="MT">Montana</asp:Li
stItem>
<asp:ListItem Value="NC">North Carolina</asp:ListItem>
<asp:ListItem Value="ND">North Dakota</asp:ListItem>
<asp:ListItem Value="NE">Nebraska</asp:L
istItem>
<asp:ListItem Value="NV">Nevada</asp:Lis
tItem>
<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="OH">Ohio</asp:ListI
tem>
<asp:ListItem Value="OK">Oklahoma</asp:L
istItem>
<asp:ListItem Value="OR">Oregon</asp:Lis
tItem>
<asp:ListItem Value="PA">Pennsylvania</a
sp:ListIte
m>
<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:List
Item>
<asp:ListItem Value="UT">Utah</asp:ListI
tem>
<asp:ListItem Value="VA">Virginia</asp:L
istItem>
<asp:ListItem Value="VT">Vermont</asp:Li
stItem>
<asp:ListItem Value="WA">Washington</asp
:ListItem>
<asp:ListItem Value="WI">Wisconsin</asp:
ListItem>
<asp:ListItem Value="WV">West Virginia</asp:ListItem>
<asp:ListItem Value="WY">Wyoming</asp:Li
stItem>
</asp:DropDownList>
Answer : asp.net How to bind a state dropdownlist?
Replace "txtTrainSessionNo" in this string with "cmbTrainSessionNo", i.e. to the name of Combobox.
Alex
Random Solutions
ESX 4.0 Does not detect onboard NIC
Crystal connection with OLE DB ADO
XSLT Parsing pairs of xml tags
phpmailer errorInfo
Which KEY do I use for my KMS Server and clients?
Unable to create virtual hard disk file on server running Hyper-V
Adding 2nd domain controller (Server 2008 R2 64bit) to existing 2003 sp2 domain
Browser Hijack
MySQL join with Like
Where can I find corflags.exe?