codecamp

ASP.NET Calendar SelectedDates 属性

ASP.NET Calendar SelectedDates 属性


Calendar 控件 Calendar 控件

定义和用法

SelectedDates 属性用于设置或返回日历中被选的日期。


实例

下面的实例在某日期被选择时输出被选日期:

<script language="VB" runat="server">
Sub Change(obj As Object, e As EventArgs)
  Dim i As Integer
  For i = 0 To Cal1.SelectedDates.Count - 1
    Response.Write(Cal1.SelectedDates(i).ToShortDateString())
    Response.Write("<br />")
  Next i
End Sub
</script>

<form runat="server">
<asp:Calendar id="cal1" runat="server"
SelectionMode="DayWeekMonth"
OnSelectionChanged="Change" />
</form>

演示实例 »

Calendar 控件 Calendar 控件
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }