mez
mez

Reputation: 5

Webform dropdownlist Value and NAME

Hi hoping this is a simple question and im just doing something silly... i have a aspx page and aspx.vb page for the code behind my webform the page has a asp dropdown list popualted from a SQL data source

ID= DDL23
DataTextField="displayname" 
DataValueField="ValueName"

in the vb file im using writer.writeElementString(DDL23.SelectedValue) inorder to get the value within the file being generated by my background code which gives me the value exactaly how i want it

how do i get the name is there something like

DDL23.SelectedName

? am i missing something simple?

the html displayed on the page is below

<select name="DDL23" id="DDL23">
<option value="this is a value">this is the displayname</option>

Upvotes: 0

Views: 1578

Answers (1)

Full Time Skeleton
Full Time Skeleton

Reputation: 1740

String selectedText = DDL23.SelectedItem.Text;

Should get you the name.

Upvotes: 1

Related Questions