Kendo DropDownList使用

//獲取核發代碼下拉并設置function GetIssuingCodeList() {$("#IssuingCode").kendoDropDownList({dataTextField: 'DropDownText',dataValueField: 'DropDownValue',index: 0,dataSource: {transport: {read: {type: 'post',dataType: "json",async: false,url: "/IssuancePurchaseOrders/IssuancePurchaseOrders/GetIssuingCodeList"}}},change: function () {var i = this.element[0].parentNode.parentNode.parentNode.rowIndex;}});KStarForm.koContentModel.IssuingCode($("#IssuingCode").data("kendoDropDownList").value());}
//kendo select的數據源格式public class DropDownBasicData{public string DropDownId { get; set; }public string DropDownValue { get; set; }public string DropDownText { get; set; }}//獲取核發代碼下拉數據public JsonResult GetIssuingCodeList(){string conaZaaSKStar = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["SAPMaster"].ToString();List result = new List();SqlDataReader dr = null;var sql = @"查找语句";dr = SqlHelper.ExecuteReader(conaZaaSKStar, System.Data.CommandType.Text, sql, null);while (dr.Read()){if (dr[0].ToString() != null && dr[0].ToString() != ""){result.Add(new DropDownBasicData { DropDownId = dr[0].ToString().Trim(), DropDownText = dr[0].ToString().Trim() + '_' + dr[1].ToString().Trim() + "_" + dr[2].ToString().Trim(), DropDownValue = dr[0].ToString().Trim() });}}//去掉重复的数据result = result.Distinct().ToList();result.Insert(0, new DropDownBasicData { DropDownId = "--請選擇--", DropDownText = "--請選擇--", DropDownValue = "" });return Json(result);}

 


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部