Stringing the DataTextField value in ASP C# Code behind?

There are occasions when I need to pass the datatextfield value along to the next page in a querey string in my ASP C# webpage.  I can't quite figure out how to do this.  I can get the datavaluefield value, but the datatextfield always just passses along the name of the column the datatextfield is drawing from in my datasource.

For example, if my datasource has two coluimns:

ItemNumber | ItemName
1                  | Candy
2                  | Hamburger

Sometimes I would want to pass the ItemNumber, and some time I want to pass the ItemName, depending on some other factors determined in the page.  I need it to work off the same single datasource and dropdownlist

  Is this even possible?
Who is Participating?
Usually you do something like this to get the selected value:


If you want the text value of the selected field then you could do:

string selectedtext = DropDownListId.Items[DropDownListId.SelectedIndex].Text;
reedsster1Author Commented:
This worked immediatly,  Thank you so much for your help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.