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