Microsoft
Software
Hardware
Network
Question : Question about ASP.NET Drop Down List Control
I’m using
Microsoft Visual Web Developer 2010
and
VB
. I created a database with a 2-character State field,
i.e
., OH for Ohio. I also have a web form on which I placed a drop down list control. I primed the drop down list control’s Items property with the names of the 50 states using the full name (
i.e.,
“Ohio”) as the Text property of the drop down list’s collection item and the corresponding 2-letter abbreviation (
i.e
., “OH”) as the Value property. When I view the form in a browser the drop down list looks fine and you can select a state from the list of 50, but as soon as I try to bind the database field to the drop-down list it doesn’t work correctly and I don’t see the collection of Items any more.
My goal is to make it so that a user can pick from the drop down list of 50 states and, when they submit the form, the database would be populated with the 2-character state abbreviation. I’ve tried setting the various properties in every way I can think of without success. It seems that when I set the drop-down list’s DataTextField (or DataValueField) property to the State field of my database, the drop down list populates from the database instead of my collection of items. How can I set the drop down list so that the user can choose from the collection of 50 states and have the corresponding abbreviation posted to the database?
Answer : Question about ASP.NET Drop Down List Control
to get the value then just use
string abbreviation = DropDownList1.SelectedValu
e;
Random Solutions
SharePoint list image link
Saving data to multiple text file
COM security setting / edit limits
Windows Time Issue for 2003 Server
Need help with display differences between IE and Firefox
How to open .BMP file with Internet Explorer in Windows XP OS.
Install Server 2008
Auto login Windows 7
Limit Files on a Samba Share - Oppisite of veto files
Mcaffe EPO 4.5 : deploying new EPO with existing agents