Calendar

Calendar控件实现客户端选择日期后隐藏

属性列表:
TargetControlID:与日历控件绑定的文本框
CssClass:日历的样式
Format:日历显示日期格式,如MMMM D,YYYY显示11/11/2005
PopupButtonID:当日期是通过选择某个按钮弹出的时候,指定按钮的ID
另外控件还提供5种客户端方法,支持用户在选择日期前后实现自定义的一些内容。
OnClientDateSelectionChanged:用户选择日期后发生的事件
OnClientHidden:客户端隐藏日历控件发生的事件
OnClientHiding:客户端隐藏日历控件前发生的事件
OnClientShowing:客户端显示日历控件前发生的事件
OnClientShown:客户端显示日历控件后发生的事件


实例解析一、简单实现与TEXTBOX的绑定效果(并实现OnClientHidden事件)

1.UI界面
<head runat="server">
    <title>无标题页</title>
    <script>
    function HideCalendarExtender()
    {
      alert("你设置了客户端隐藏控件要发生的事件了!");
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
   
    </div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <cc1:CalendarExtender ID="CalendarExtender1" runat="server" Format="yyyy-mm-dd" OnClientHiding="HideCalendarExtender"
            TargetControlID="TextBox1">
        </cc1:CalendarExtender>
    </form>
</body>

实例解析二、多种显示的样式

1.日历控件的选择样式
  通过Animated属性设置
2.日期显示格式
Format="yyyy-mm-dd"或"yyyy/M/d"(2007/2/8)或"yy-M-d"(07-2-8)或"yyyy-MM"(2007-5)或"yyyy年MM有dd日"(2007年6年20日)

 

原文地址:https://www.cnblogs.com/astar/p/961088.html