kendo-------------添加dropDowList

需要引用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);
        }

posted on 2016-05-04 08:56  乖乖的小莹儿  阅读(329)  评论(0编辑  收藏  举报