It quite easy to work with dropdown list. You just need to drag-and drop it. But let just work with it.

Suppose, we want to add an datasource which have multiple fields, or coming from database SELECT with multiple fields.

Lets we have a List<User> from Facebook which have properties but we want to see the Name as dropdown text which is in the User object written as “name” and set the value to UserId which is written as “uid”.


Now what we could do is just set the datasource to the List<User> and then specify the “DataTextField” and “DataValueField”.

IList<user> friendList = Master.Api.Friends.GetUserObjects();           
          ddlFriends.DataSource = friendList;
          ddlFriends.DataTextField = "name";
          ddlFriends.DataValueField = "uid";


Ok, Also if you want to make the text color different in every row or change the row background you can use the following code section: after the “DATABIND()” method

For text only:

ddlFriends.Items[count].Attributes.Add("style", "color:#FC8105");

For Background:

ddlFriends.Items[count].Attributes.Add("style", "background-color:#51D9E8");