首页 > 代码库 > Master page and jquery

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="text/javascript" src=http://www.mamicode.com/"<%=ResolveClientUrl("~/Script/jquery-1.11.1.min.js") %>"></script>    <script type="text/javascript" src=http://www.mamicode.com/"<%=ResolveClientUrl("~/Script/jquery-ui-1.11.0.custom/jquery-ui.min.js")%>"></script>    <script type="text/javascript" src=http://www.mamicode.com/"<%=ResolveClientUrl("~/Script/jquery-ui-1.11.0.custom/zh-CN/jquery.ui.datepicker-zh-CN.js")%>"></script>    <script type="text/javascript" src=http://www.mamicode.com/"<%=ResolveClientUrl("~/Script/common_ui.js")%>"></script>    <link rel="stylesheet" type="text/css" href=http://www.mamicode.com/"<%=ResolveClientUrl("~/Script/jquery-ui-1.11.0.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>
View Code


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>
View Code


DatePicker-zh-CN

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


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");            }, 1);        },        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");            }, 1);        }    });    /*-------------------- 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);});
View Code