asp.net - Get DataRow from the DropDownList -


i doesn't know how convert dropdownlist selected item datarow

sdropdownlist.datasource = gettable();     sdropdownlist.datatextfield = "name";      sdropdownlist.datavaluefield = "id";   

i tried datarow dropdownlist this.. .

   datarow row = (sdropdownlist.selecteditem datarowview).row;  

but error .. . errors can't convert listitems datarows

it's not datarow on postback. dropdownlist's item has text , value since it's listitem. if need other informations record later (on postback) have query database again.

actually have need since you've set datavaluefield id-column.

int id = int.parse(sdropdownlist.selectedvalue); // query database whole record or information need 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -