ligerComboBox下拉列表

设置值:

$("#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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值