简体   繁体   中英

concatenate combobox values in c# from a web service

I have no way of modifying the web service and I want to be able to add the 2 columns together with a space in between. While adding this to a combo box. Can someone help? I tried adding "SiteId" + "" + "SiteName". But I am not sure how to call these values while working with a Soap method to add the 2 columns and display in one combo-box.

Any tips or help would be great!

         MyServices.OnlineReservationService getSites = new MyServices.OnlineReservationService();
        DataSet dd = new DataSet();
        dd = getSites.GetSites();


        CmbSite.DataSource = dd.Tables[0];
        CmbSite.DisplayMember = "SiteId";
 DataSet dd = new DataSet();
        dd = getSites.GetSites();
dd .Columns.Add("Display", typeof(string), "SiteId+ ' ' + SiteName");

dropdownlist1.DataSource = dd.Tables[0];;
CmbSite.DisplayMember= "Display";
CmbSite.Valumember= "SomeValue";
CmbSite.DataBind();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM