Select DropDownList Text Dynamically

  • Thread starter Will Chamberlain
  • Start date
W

Will Chamberlain

For an Edit User section of my application I have created a DataReader
that sets textbox.text values = objDataReader("field"). One of the
fields in the table is Department and to display this I have chosen to
use a dropdownlist. I have tried setting:

ddlDepartment.SelectedItem.Text = objDataReader("Department")

The departments are:

Administration - Value 1
Finance - Value 2
Engineering - Value 3

When I use the method above It simply replaced Administration with
whatever the user is saved as but the value still stays the same.

I know this sounds confusing but if needed I can elaborate.

- Will
 
R

Raul Macias

You would need to do something like this:

string sValue = objDataReader("Department");
ddlDepartment.SelectedValue = sValue;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top