Master page and jquery

1.download latest jqury http://jquery.com/download/

2.download latest jquery.ui, Theme select "Blitzer" http://jqueryui.com/download/#!zThemeParams=5d00000100f305000000000000003d8888d844329a8dfe02723de3e5700bbb34ecf36ce5959f380e613cafa997b39424a52ffc947ae6386d03dcb468a5a6d1623ac0d0e3e18cdf4fca8f2d1c997c7af2b425437a134e5b366f618af5193c1d8772b526c0c53c8f5528cb98c54b6fe385b01ee1763c1d4611100b242ec920a41206d3963eee0327838569a479d191f5adfb7b3ffee4f7265bdf6e03b09d243b90abaeb609b96eee56cef6cc0633865895078988ec40819895711fa7efb93b110f6e1b1b1557039d6178c8824adfa105fdfe1f7011f178cbd9f593de821bf90d0a04f35b5f6ca2fe4ccb9ee832eb806819e5b9aa863e9b8246d16fb230a7cb628f97fc471014be50dac4872e81d9821984e5cb27e4c8026968a9b1e80247bd040d1ef8e047f0ae98998cf329c56654903d9807c1e8c51dcb22b9bb42ca22a9b30ab0c2ae230b6228bbf56f8dbb62a2e49281585710b64c5e25d34da872f883d0d15a3f9716d9f34e297cc883697927ddea3a4e56a1de81985f7db5ee4e62567eaaedcd8b802411687a738bb9921d9eba82ca5c09d328015ecf731114054d32c5cb2354800f07cf72fe329c69ef9a2b9f897e6a0e64abf6d605c0ce92167ab590565246907805b9d96399a15ff8a61c815970937e0cc48650f5e8bd2de19096fe950d8484dff5f18410d74ffdd71567

Site.Master

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="KLSTest.Site" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type=.min.js") %>"></script>
    <script type=.custom/jquery-ui.min.js")%>"></script>
    <script type=.custom/zh-CN/jquery.ui.datepicker-zh-CN.js")%>"></script>
    <script type="text/javascript" src="<%=ResolveClientUrl("~/Script/common_ui.js")%>"></script>
    <link rel=.custom/jquery-ui.min.css")%>" />
    <asp:ContentPlaceHolder ID="scripts" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form runat="server">
        <div>
            <asp:ContentPlaceHolder ID="bodyContent" runat="server">
            </asp:ContentPlaceHolder>
        </div>
    </form>
</body>
</html>

Child Page

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="DatePickerTest.aspx.cs" Inherits="KLSTest.DatePickerTest" %>

<asp:Content ID="Content1" ContentPlaceHolderID="scripts" runat="server">
    <script type="text/javascript">
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="bodyContent" runat="server">
    <asp:TextBox ID="dateSelect" runat="server" CssClass="jDatePicker"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" />
</asp:Content>

DatePicker-zh-CN

jQuery(function ($) {
    $.datepicker.regional['zh-CN'] = {
        closeText: '关闭',
        prevText: '<上月',
        nextText: '下月>',
        currentText: '今天',
        monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
        '七月', '八月', '九月', '十月', '十一月', '十二月'],
        monthNamesShort: ['一', '二', '三', '四', '五', '六',
        '七', '八', '九', '十', '十一', '十二'],
        dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
        dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
        dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
        weekHeader: '周',
        dateFormat: 'yy-mm-dd',
        firstDay: ,
        isRTL: false,
        showMonthAfterYear: true,
        yearSuffix: '年'
    };
    $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
});

DatePicker Initalization common_ui.js

$(function () {
    /*-------------------- Date Picker --------------------------------------------*/
    /*---- how to use: <asp:TextBox ID="TextBox1" runat="server" CssClass="jDatePicker"></asp:TextBox>---*/
    if (!$('.jDatePicker').hasClass('readonly_submit')) {
        $('.jDatePicker').addClass('readonly_submit');
    }
    $('.jDatePicker').datepicker({
        showButtonPanel: true,
        beforeShow: function (input) {
            setTimeout(function () {
                var buttonPane = $(input)
                    .datepicker("widget")
                    .find(".ui-datepicker-buttonpane");

                $("<button>", {
                    text: "清除",
                    click: function () {
                        $.datepicker._clearDate(input);
                    }
                }).appendTo(buttonPane).addClass("ui-datepicker-clear ui-state-default ui-priority-primary ui-corner-all");
            }, );
        },
        onChangeMonthYear: function (year, month, instance) {
            setTimeout(function () {
                var buttonPane = $(instance)
                    .datepicker("widget")
                    .find(".ui-datepicker-buttonpane");

                $("<button>", {
                    text: "清除",
                    click: function () {
                        $.datepicker._clearDate(instance.input);
                    }
                }).appendTo(buttonPane).addClass("ui-datepicker-clear ui-state-default ui-priority-primary ui-corner-all");
            }, );
        }
    });

    /*-------------------- Input : Readonly but can be submit  --------------------------------------------*/
    /*---- how to use: <asp:TextBox ID="TextBox1" runat="server" CssClass="readonly_submit"></asp:TextBox>---*/
    $('.readonly_submit').on('paste', function (e) { e.preventDefault(); return false; });
    $('.readonly_submit').on('keydown', function (e) { e.preventDefault(); return false; });
    $('.readonly_submit').attr('autoComplete', 'off');
});
上一篇:C#与Java同步加密解密DES算法


下一篇:Android -- EventBus解析