博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
kendo-------------添加dropDowList
阅读量:5287 次
发布时间:2019-06-14

本文共 2129 字,大约阅读时间需要 7 分钟。

需要引用kendo.js

   <link type="text/css" href="../css/bootstrap.min.css" rel="stylesheet" />

    <link type="text/css" href="../css/kendo/kendo.common.min.css" rel="stylesheet" />
    <link type="text/css" href="../css/kendo/kendo.metro.min.css" rel="stylesheet" />
    <script src="/Scripts/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery-migrate-1.3.0.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/kendo/jszip.min.js"></script>
    <script type="text/javascript" src="../js/kendo/kendo.all.min.js" ></script>

 

------------UI-----------------------------

<input id="ddlStatus" />

--------------js------------------------------

------单选

function GenerateAssetStatusDropDownList() {

    $("#ddlStatus").kendoDropDownList({
        filter: "startswith",
        ignoreCase: true,
        placeholder: "Select Status",
        dataTextField: "Text",
        dataValueField: "Value",
        dataSource: {
            type: "json",
            transport: {
                read: {
                    type: "POST",
                    cache: false,
                    url: "/ajaxCommon/GetAssetStatus",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json"
                }
            },
            schema: {
                parse: function (response) {
                    return response;
                }
            }
        }
    });
}

 --多选

function GenerateDensityDropDownList(){

    $("#multiDensity").kendoMultiSelect({
        autoClose: false,
        tagMode: "single",
        placeholder: "Select Density",
        dataTextField: "name",
        dataValueField: "name",
        dataSource: [
            { name: "400DPI" },
            { name: "HDPI" },
            { name: "XHDPI" },
            { name: "XXHDPI" },
            { name: "XXXHDPI" }
        ]
    });
}

----------------------Controllers----------------

 

 

public ActionResult QueryNonDesignerProjectSku()

        {
            List<ajaxModel.DropDownListBox> Packages = new List<ajaxModel.DropDownListBox>();
            using (AssetReleaseSystemEntities DBContext = new AssetReleaseSystemEntities())
            {
                List<string> packageNames = DBContext.Configuration_Detail.Where(d => d.MasterID == 55).Select(d => d.Value).ToList();
                Packages = packageNames.Select(p => new ajaxModel.DropDownListBox()
                {
                    Text = p,
                    Value = p
                }).ToList();
                Packages.Insert(0, new ajaxModel.DropDownListBox() { Text = "All", Value = "" });
            }
            return Json(Packages, JsonRequestBehavior.AllowGet);
        }

转载于:https://www.cnblogs.com/gracexy/p/5457220.html

你可能感兴趣的文章
调试学习笔记
查看>>
解开lambda最强作用的神秘面纱
查看>>
Java基础:Object类中的equals与hashCode方法
查看>>
C#拦截Http请求
查看>>
图片下载器
查看>>
找不到docker.socket解决方法
查看>>
Activity生命周期
查看>>
sql server和mysql中分别实现分页功能
查看>>
kafka server管理
查看>>
系统设计与分析(六)
查看>>
Java IO-1 File类
查看>>
HW5.29
查看>>
Linux查看物理CPU个数,核数,逻辑CPU个数;内存信息
查看>>
sqlserver查询效率
查看>>
FoxMail邮件设置
查看>>
percona-toolkit 之 【pt-online-schema-change】说明
查看>>
[模板]大数加法
查看>>
ZeroBrane Lua脚本编辑器代码自动补全
查看>>
linux下播放mp3
查看>>
POJ1611-The Suspects-并查集
查看>>