c# - Unable to bind data to DropDownList -


i binding xml values dropdownlist. below code:

protected void loaddropdown() {      dataset ds = new dataset();      ds.readxml (server.mappath(@"xmlfile1.xml"));       dropdownlist1.datatextfield = "country_id";                dropdownlist1.datasource = ds;      dropdownlist1.databind();      dropdownlist1.items.insert(0,new listitem(" select ","0")); }      

i want country names in dropdownlist, getting id values 0,1,2,3. doing wrong?

try specifying else datatextfield:

dropdownlist1.datatextfield = "country_name"; //this value depends on xml structure is. dropdownlist1.datavaluefield = "country_id"; 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -