コード例 #1
0
        public JsonResult GetRegionsDropdown(string RCountryID, string ParentRegionID, string Latitude, string Longitude)
        {
            DropDownListsRepository modelRepo = new DropDownListsRepository();
            return new JsonResult()
            {
                Data = (modelRepo.GetRegionsDropdown(RCountryID, ParentRegionID, Latitude, Longitude).OrderBy(o => o.Name).Select(c => new { Value = c.ID, Text = c.Name }).OrderBy(o => o.Text)),

                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                MaxJsonLength = Int32.MaxValue
                //Use this value to set your maximum size for all of your Requests
            };
        }
コード例 #2
0
        public static SelectList GetRegionsMultpleDropdown(string CountryID, string RegionID, string Latitude, string Longitude)
        {
            DropDownListsRepository modelRepo = new DropDownListsRepository();
            var Regions = modelRepo.GetRegionsDropdown(CountryID, RegionID, Latitude, Longitude);

            List<SelectListItem> _ListRegions = new List<SelectListItem>();

            foreach (var item in Regions)
            {
                SelectListItem itr = new SelectListItem();
                itr.Text = item.Name;
                itr.Value = item.ID.ToString();
                itr.Selected = false;

                _ListRegions.Add(itr);
            }

            return new SelectList(_ListRegions, "Value", "Text");
        }