asp.net mvc jQuery 城市二级联动
2016-01-26 13:00
441 查看
页面效果图:
View Code
namespace Mvcproject.Controllers { //二级联动 public class ErJLDController : Controller { ZjbEntities db = new ZjbEntities(); // // GET: /Test/ public ActionResult Index() { //pro_city province=new pro_city(); return View(); } public JsonResult getProvince() { List<pro_city> provinceList = (from p in db.pro_city where p.level == 1 select p).ToList(); JsonResult Jprovince = new JsonResult(); Jprovince.Data = provinceList; Jprovince.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return Jprovince; } public JsonResult getCity(string pName) { //string pid = (from p in db.pro_city where p.areaValue == pName select p.id).ToString(); //int id = int.Parse(pid); int id = int.Parse(pName); List<pro_city> cityList = (from p in db.pro_city where p.parentId == id select p).ToList(); JsonResult Jcity = new JsonResult(); Jcity.Data = cityList; Jcity.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return Jcity; } } } ErJLDController.cs
View Code
相关文章推荐
- jquerymobile的content高度100%占满屏幕剩余空间
- 自己对html、javascript、jQuery、css的区别
- jQuery练习(一)
- jQuery命名空间,自定义空间及属性,插件开发全解析
- Hallo.js基于jQuery UI所见即所得的Web编辑器
- jQuery和Zepto冲突问题【解决】
- Jquery 中的回调函数
- jquery字符串&Json互转
- jQuery获取css值
- 关于jquery easyui treegrid的问题
- Django1.6+jQuery Ajax + JSON 实现页面局部实时刷新
- 通过jQuery Ajax使用FormData对象上传文件
- jQuery Validation Plugin验证插件手动验证
- 黑马day16 jquery&层次选择器
- Jquery-easyui工具easyuiUtils
- Jquery-数据验证JS工具checkUtils
- 12个JQuery小贴士
- jquery选择器
- jQuery实现的指纹扫描效果实例(附演示与demo源码下载)
- jQuery form插件的使用--处理server返回的JSON, XML,HTML数据