c# - ASP.NET Application - Accessing details about a drop down list's DataSource -


i have following markup:

   <td>       <asp:dropdownlist runat="server" id="ddlextroutebusyid" style="width: 320px;" />    </td> 

and code behind executes on page load:

//bind route busy drop down list: datatable dr = /*[some datatable returned wrapper rdbms*/; this.ddlextroutebusyid.datasource = dt; this.ddlextroutebusyid.datatextfield = "description"; this.ddlextroutebusyid.datavaluefield = "id"; this.ddlextroutebusyid.databind(); 

i cannot seem access description , id data based upon value of selecteditem/value. example if select second list item, selectedindex 1, description might "server2" , id might 1118. how can pull description , id values?

thanks.

you can use following text , value:

ddlextroutebusyid.selecteditem.text ddlextreoutebusyid.selecteditem.value 

if doesn't work there may other problem page doing, since verified these worked me.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -