Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Preselect a value in a DropDown list
Message
From
28/07/2003 10:56:21
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Preselect a value in a DropDown list
Miscellaneous
Thread ID:
00814120
Message ID:
00814120
Views:
45
I'm using ASP.Net to create a Webform. My Webform contains a State drop down list. I populate the drop down with values from my state.dbf table.

The Webform is an editing form that allows you to modify an employee's information. How can I preselect the correct state in the drop down list based on the current employee's state value?

The SelectedIndex works if you know the row, but what if you only know the character value such as 'OH'?

Here's how I populate the state drop down:
this.cbo_loc.DataTextField = "cstate";  //From state.dbf.
this.cbo_loc.DataValueField = "cstate"; //From state.dbf.
this.cbo_loc.DataSource = myDS;
//this.cbo_loc.SelectedIndex = 2;  //This will work but I only know the char value.
this.cbo_loc.DataBind();
Thanks,

Jerry
Next
Reply
Map
View

Click here to load this message in the networking platform