如何更改其他站点Web服务值 [英] How do I change other site webservice values
本文介绍了如何更改其他站点Web服务值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友们,
我将通过以下网址从webservice获取城市: [ ^ ]
执行。但我可以改变价值观吗?对于Eg。在那个城市名单上有马德拉斯。我需要改变马德拉斯作为钦奈并改变城市的秩序。是否可以改变。
我尝试过:
获得城市:
net.webservicex.www.GlobalWeather we = new net.webservicex.www.GlobalWeather();
string country = ddlCountry.SelectedValue.ToString();
string city = we.GetCitiesByCountry(country);
var cities = XDocument.Parse(city).Descendants(City)。选择(arg => arg.Value).ToList();
ddlCity.DataSource = cities;
ddlCity.DataBind();
解决方案
一旦从服务中获取数据,您将修改该集合
列表< string> lstCities = new List< string>();
foreach(城市中的字符串城市)
{
string _city = city;
if(city ==Madras)
_city =Chennai;
lstCities.add(_city);
}
ddlCity.DataSource = lstCities;
ddlCity.DataBind();
Dear friends,
I am getting cities from webservice in the following url: [^]
Its executed. but can i change values. for Eg. in that cities list have Madras. I need to change madras as chennai and change order of the cities. Is it possible to change.
What I have tried:
getting city:
net.webservicex.www.GlobalWeather we = new net.webservicex.www.GlobalWeather(); string country = ddlCountry.SelectedValue.ToString(); string city = we.GetCitiesByCountry(country); var cities = XDocument.Parse(city).Descendants("City").Select(arg => arg.Value).ToList(); ddlCity.DataSource = cities; ddlCity.DataBind();
解决方案
you shall modify the collection once you get the data from the service
List<string> lstCities = new List<string>(); foreach (string city in cities) { string _city = city; if(city == "Madras") _city = "Chennai"; lstCities.add(_city); } ddlCity.DataSource = lstCities ; ddlCity.DataBind();
这篇关于如何更改其他站点Web服务值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文