• 2015-11-04 asp.net 弹出式日历控件 选择日期 Calendar控件


    html代码:

    <%@ Page Language="C#" CodeFile="calendar.aspx.cs" Inherits="calendar" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:Panel ID="Panel1" runat="server" Height="27px" Width="540px">
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                &nbsp;&nbsp;&nbsp;
                <asp:Button ID="Button1" runat="server" OnClick="btnOnClick" Text="选择" />
                <div id="LayerCC" style="left: 155px; 189px; position: absolute; top: 55px;
                    height: 191px;
                    <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="#3366CC"
                        BorderWidth="1px" CellPadding="1" Font-Names="Verdana" Font-Size="8pt" ForeColor="#003399"
                        Height="200px" OnSelectionChanged="Calendar1_SelectionChanged" Width="220px">
                        <SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                        <SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
                        <WeekendDayStyle BackColor="#CCCCFF" />
                        <TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
                        <OtherMonthDayStyle ForeColor="#999999" />
                        <NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
                        <DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" />
                        <TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px" Font-Bold="True"
                            Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
                    </asp:Calendar>
                </div>
            </asp:Panel>
        </div>
        </form>
    </body>
    </html>
    参考代码C#部分

    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;

    public partial class calendar : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnOnClick(object sender, EventArgs e)
        {
            LayerCC.Visible = !LayerCC.Visible;

        }
        protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
            TextBox1.Text = Calendar1.SelectedDate.ToString("yyyy-MM-dd");
            LayerCC.Visible = false;


        }
    }
    效果图:

    [转载]asp.net <wbr>弹出式日历控件 <wbr>选择日期 <wbr>Calendar控件

  • 相关阅读:
    clion打断点不生效
    PHP加密解密
    细说MySQL表操作
    细说MySQL数据库操作
    终端(命令行)连接MySQL
    MySQL结构
    求1!+(1!+3!)+(1!+3!+5!)+...+(1!+3!+5!+7!+9!)的值
    react 生命周期
    React TS 组件 Demo
    react-redux 实现原理
  • 原文地址:https://www.cnblogs.com/hutie1980/p/4935184.html
Copyright © 2020-2023  润新知