First, get the data from the service and assign it to a container such a collection list. Then iterate trhough the collection, and assign the value to the dropdown list. In the example below, assume that you want to return a list of Status to your dropdown list (ddlStatus).
You can also assign the data returned from the service directly to the dropdown list as the ddlStatus.DataSource, and then bind it (see example 2).
Example 1:
ServiceReference1.ProductServiceClient obj = new ServiceReference1.ProductServiceClient();
List<lookupoption> statusLookupOptions = obj.GetStatusLookup();
if (statusLookupOptions != null)
{
foreach (LookupOptionItem lookupOperationStatusItem in statusLookupOptions .LookupOptionItems)
{
ddlStatus.Items.Add(new ListItem(lookupOperationStatusItem.DisplayText, lookupOperationStatusItem.ID.ToString()));
}
}</lookupoption>
Example 2:
ddlStatus.DataSource = obj.GetStatusLookup();
ddlStatus.DataTextField="TitleColumn";
ddlStatus.DataValueField="ValueColumn";
ddlStatus.DataBind();