📄 calendar.aspx
字号:
<html>
<head>
<script language="C#" runat="server">
void Date_Selected(object s, EventArgs e) {
switch (Calendar1.SelectedDates.Count) {
case (0): //当没有任何选择
Label1.Text = "您没有选择";
break;
case (1): //当选择了日期
Label1.Text = "选择的日期是" +
Calendar1.SelectedDate.ToShortDateString();
break;
case (7): //当选择了week
Label1.Text = "这个星期以" +
Calendar1.SelectedDate.ToShortDateString()+"开始";
break;
default: //当选择了Month
Label1.Text = "这个月以" +
Calendar1.SelectedDate.ToShortDateString()+"开始";
break;
}
}
</script>
</head>
<body>
<h3>日历</h3>
<p>
<form runat=server>
<p>
<asp:Calendar id=Calendar1 runat="server"
onselectionchanged="Date_Selected"
DayNameFormat="Full"
SelectionMode="DayWeekMonth"
Font-Name="Verdana;Arial" Font-Size="12px"
Height="180px" Width="230px"
TodayDayStyle-Font-Bold="True"
DayHeaderStyle-Font-Bold="True"
OtherMonthDayStyle-ForeColor="gray"
TitleStyle-BackColor="lightgreen"
TitleStyle-ForeColor="white"
TitleStyle-Font-Bold="True"
SelectedDayStyle-BackColor="yellow"
SelectedDayStyle-Font-Bold="True"
NextPrevFormat="ShortMonth"
NextPrevStyle-ForeColor="white"
NextPrevStyle-Font-Size="10px"
SelectorStyle-BackColor="green"
SelectorStyle-ForeColor="navy"
SelectorStyle-Font-Size="9px"
SelectWeekText = "周"
SelectMonthText = "月"
/>
<p>
<asp:Label id=Label1 runat="server" />
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -