c# - How to set the datatextfield value instead of the value on a drop down list? -


i have list of countries, returns id , name. have string. drop down sets value id, @ point don't have id's. want able set selectedvalue text field. there way this? or there way compare string against list work out id?

string country = "australia"; ddlcountry.datasource = listofcountries; ddlcountry.datatextfield = "value"; ddlcountry.datavaluefield = "key"; ddlcountry.databind();  ddlcounty.selectedvalue = ??? 

thanks

 ddlcountry.items.findbytext(country).selected = true 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -