Asp.net mvc 添加Jquery UI


1.使用NuGet下載jquery ui

Install-Package jQuery.UI.Combined

2.下載多語言文件:

development-bundle/i18n目錄下是jquery的日歷語言。注:只有Legacy版本才有

也可以用nuget下載

Install-Package jQuery.UI.i18n

2.編輯 BundleConfig.cs

注意:這里我用了自己下載的一個theme"start",自己下才有 http://jqueryui.com/download/

 

//jquery-ui
            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                "~/Content/themes/start/jquery-ui.js"));

            bundles.Add(new StyleBundle("~/Content/jqueryui").Include(
                "~/Content/themes/start/jquery-ui.css"));
            bundles.Add(new ScriptBundle("~/Content/themes/i18n").Include(
                "~/Content/themes/i18n/jquery.ui.datepicker-zh-CN.js"));

 

3.編輯_Layout.cshtml頁

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryui")
    @Scripts.Render("~/Content/themes/i18n")

 

4.在view頁面中使用

<input id="datepicker" >
<!-- Datepicker -->


<script>
    $("#datepicker").datepicker({
        inline: true
    });

</script>

5.下面測試一下:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM