mvc 下拉框级联

function GetAreaSelect() {
            var url = '@Url.Content("~/ContactsManage/LoadSelectArea")';
            $.getJSON(url, function (data) {
                var str = "";
                $.each(data, function (i, item) {
                    str += "";
                });
                $("#areaId").html(str);
            });
        }

        ///


        /// 加载地区下拉框
        ///

        ///
        public ActionResult LoadSelectArea()
        {
            List areaSelectList = new List();
            SelectListItem sItem = new SelectListItem();
            sItem.Text = LanguageHelper.GetWord("PleaseSelect");
            sItem.Value = Guid.Empty.ToString();
            areaSelectList.Add(sItem);
            List areaList = areaBll.GetModelList("Area_ParentId!=-1 AND Area_Level=1");
            foreach (T_Data_AreaModel model in areaList)
            {
                SelectListItem it = new SelectListItem();
                it.Text = model.Area_Name;
                it.Value = model.Id.ToString();
                areaSelectList.Add(it);
            }
            return Json(areaSelectList,JsonRequestBehavior.AllowGet);
        }

你可能感兴趣的:(mvc 下拉框级联)