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
Post a Comment