Exemplo n.º 1
0
        public void GetAreaDropdownContact(string id, string area)
        {
            int cid = 0;

            int.TryParse(id, out cid);
            DataTable   dSubCate       = new DataTable();
            UserDetails objUserDetails = new UserDetails();

            dSubCate = objUserDetails.GetArea(Convert.ToInt32(cid)).Tables[0];
            IList <Location> items = dSubCate.AsEnumerable().Select(row =>
                                                                    new Location
            {
                Area   = row.Field <string>("AreaValue"),
                Suburb = row.Field <string>("AreaText")
            }).ToList();
            var list = new SelectList(items, "Area", "Suburb", area);

            ViewData["ContactArea"] = list;
        }
Exemplo n.º 2
0
        public JsonResult GetArea(string id)
        {
            int cid = 0;

            int.TryParse(id, out cid);
            DataTable   dSubCate       = new DataTable();
            UserDetails objUserDetails = new UserDetails();

            dSubCate = objUserDetails.GetArea(Convert.ToInt32(cid)).Tables[0];
            IList <Location> items = dSubCate.AsEnumerable().Select(row =>
                                                                    new Location
            {
                Area   = row.Field <string>("AreaValue"),
                Suburb = row.Field <string>("AreaText")
            }).ToList();
            var location = (from loc in items
                            select new
            {
                label = loc.Area.Trim(),
                val = loc.Suburb
            }).ToList();

            return(Json(location));
        }