コード例 #1
0
        public JsonResult getcity(string stateid)
        {
            List <SelectListItem> cities = new List <SelectListItem>();
            int ID = Convert.ToInt32(stateid);

            OrgService.OrganizationServiceClient organizationservice = new OrgService.OrganizationServiceClient();
            string  strXMLCities = organizationservice.GetCityList(ID);
            DataSet dsCities     = new DataSet();

            dsCities.ReadXml(new StringReader(strXMLCities));
            if (dsCities.Tables.Count > 0)
            {
                foreach (System.Data.DataRow row in dsCities.Tables[0].Rows)
                {
                    cities.Add(new SelectListItem()
                    {
                        Text = row["City_Name"].ToString(), Value = row["City_ID"].ToString()
                    });
                }
            }
            return(Json(cities, JsonRequestBehavior.AllowGet));
        }