dropdownlist.?

  • Thread starter Thread starter Raymond Chiu
  • Start date Start date
R

Raymond Chiu

I have the following code and want to assign to dropdown list. But I don't
know how to assign?

IList<UIModel.Country> a=getcountrycodeandname();
dropdownlist1.??= a.countrycode // it seems has error to access a
dropdownlist1.?? = a.countryname // it seems has error to access
a.countryname, don't how to access ILIST a???

Please help!!!
 
Hi Raymond,
try this instead assuming you want the country code to be the actual value
and county name to be the display text.
IList<UIModel.Country> a=getcountrycodeandname(); dropdownlist1.DataSource = a;
dropdownlist1.DataValueField = "countrycode"; dropdownlist1.DataTextField
= "countryname";
dropdownlist1.DataBind();

Cheers
SteveS
 
Back
Top