关闭

ligerComboBox下拉列表

10652人阅读 评论(2) 收藏 举报
分类:

设置值:

$("#comtype").ligerGetComboBoxManager().setValue(data.SPType);

 

 

加载方法一:

<input type="text" id="messagetype" name="messagetype" />

 

//获取提示类别

function GetMessageTypeDictionary() {

$.post('@Url.Action("GetMessageTypeDictionary", "Message")',

function (json) {

$("#messagetype").ligerComboBox({ data: json,lable: '类型', labelWidth: 100, labelAlign: 'right' });                

       }, "json"

);

}

  

[HttpPost]

public string GetMessageTypeDictionary()

{

string json = "";

JavaScriptSerializer jss = new JavaScriptSerializer();

List<Model.BusDictionary>busdiclist = new List<Model.BusDictionary>();

BLL.BusDictionary bllcity = new BLL.BusDictionary();

string strwhere = "";

strwhere = " BusType='serproduct' ";

busdiclist =bllcity.GetModelList(strwhere);

json=jss.Serialize(busdiclist);

json = json.Replace("BusDicName", "text");

json = json.Replace("BusDicNum", "id");

 

return json;

}

 

加载方法二:

public ActionResult Index()

{

ViewBag.PSType =GetSPType();

return View();

}

 

//获得类型 下拉

public string GetSPType()

{

string json = "";

JavaScriptSerializer jss = new JavaScriptSerializer();

BLL.BusDictionary bllbd = new BLL.BusDictionary();

List<Model.BusDictionary>bdlist = new List<Model.BusDictionary>();

string opid = (string)Session["UserGUID"];

BLL.Sys_OperatorArea blloa = new BLL.Sys_OperatorArea();

List<Model.Sys_OperatorArea> oalist = new List<Model.Sys_OperatorArea>();

oalist =blloa.GetModelList(string.Format("GUID='{0}'", opid));

string cityid = "";

if (oalist.Count > 0)

{

foreach (Model.Sys_OperatorArea oa in oalist)

{

cityid += string.Format("'{0}',", oa.CityID);

}

cityid =cityid.Substring(0, cityid.Length - 1);

 

bdlist =bllbd.GetModelList(string.Format(" BusType='serproduct' and DELETEFLAG='0' and Area in({0}) ",cityid));

 

var b = bdlist.Select(d => new

{

text = d.BusDicName,

id = d.BusDicNum

});

json = jss.Serialize(b);

}

return json;

}

 

var strProcedureName = '@Html.Raw(ViewBag.PSType)'

//生成类型 下拉

var selectdata = eval(strProcedureName);

for (var i = 0; i < selectdata.length; i++) {

$("#seleSPType").append("<option value='" + selectdata[i].id + "'>" + selectdata[i].text + "</option>");

}

0
1

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:123681次
    • 积分:1650
    • 等级:
    • 排名:千里之外
    • 原创:52篇
    • 转载:9篇
    • 译文:0篇
    • 评论:4条
    最新评论