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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top