数据列表初始化下拉框及下拉树

来源:互联网 发布:火影手游网络连接异常 编辑:程序博客网 时间:2024/05/21 10:12
前台脚本初始化类型下树
      $('#StyleID').combotree({
           editable: false,
            url: pageConfig.GetStyle,
             multiple: true,
             checkbox: true,

            }); 

获取文本框的值并存成数组,且用,隔开

StyleID: $("#StyleID").combotree('getValues').join(','), 

在Controllers写从数据库获取数据的方法

public ActionResult GetStyle()

      {
          StyleLableBll stbll = new StyleLableBll();
          var listStyle = stbll.Search(x => true).Select(x => new { id = x.ID, text = x.ShopStyle }).ToList();
          return Json(listStyle);
      }