ASP.NET CalendarDay 控件代表 calendar 控件中的一天
属性
属性 | 描述 | .NET |
---|---|---|
Date | 该控件的日期变量。 | 1.0 |
DayNumberText | 日期的日期编号(字符串)。 | 1.0 |
IsOtherMonth | 规定该日期是否是显示在日历中的月份以外的另一个月份中的日期 | 1.0 |
IsSelectable | 规定日期是否可选。 | 1.0 |
IsSelected | 规定日期是否被选定 | 1.0 |
IsToday | 规定日期是否是今天的日期 | 1.0 |
IsWeekend | 规定日期是否是星期六或星期日 | 1.0 |
ASP.NET CalendarDay Date 属性
ASP.NET CalendarDay Date 属性用于获取表示日期的日期变量
范例
下面的范例显示了如何从日历中选定的日期获取日期
<script runat="server">
Sub DaySelect(obj As Object, e As DayRenderEventArgs)
If e.Day.IsSelected Then
Label1.Text = e.Day.Date
End If
End Sub
</script>
<form runat="server">
<asp:Calendar id="cal1" runat="server"
OnDayRender="DaySelect" />
The selected date is:
<asp:Label id="Label1" runat="server"/>
</form>
ASP.NET CalendarDay DayNumberText 属性
ASP.NET CalendarDay DayNumberText 属性用于获取表示日期的日期编号的一个字符串
范例
下面的范例显示了如何从日历中选定的日期获取 DayNumberText
<script runat="server">
Sub DaySelect(obj As Object, e As DayRenderEventArgs)
If e.Day.IsSelected Then
Label1.Text = e.Day.DayNumberText
End If
End Sub
</script>
<form runat="server">
<asp:Calendar id="cal1" runat="server" OnDayRender="DaySelect" />The selected date is: <asp:Label id="Label1" runat="server"/>
</form>
ASP.NET CalendarDay IsOtherMonth 属性
ASP.NET CalendarDay IsOtherMonth 属性用于获取日期是否属于日历所显示的月份
如果日期属于所显示的月份,则该属性返回 "FALSE",否则返回 "TRUE"
范例
下面的范例显示了被选日期是否属于当前月
<script runat="server">
Sub DaySelect(obj As Object, e As DayRenderEventArgs)
If e.Day.IsSelected Then
If e.Day.IsOtherMonth = "TRUE" Then
Label1.Text = "NO"
Else
Label1.Text = "YES"
End If
End If
End Subv
</script>
<form runat="server">
<asp:Calendar id="cal1" runat="server" OnDayRender="DaySelect"/>The selected date is in the current month:
<asp:Label id="Label1" runat="server"/>
</form>
ASP.NET CalendarDay IsSelectable 属性
ASP.NET CalendarDay IsSelectable 属性用于获取或设置日期是否为可选
如果日期可选,则该属性返回 "TRUE",否则返回 "FALSE"
范例
下面的范例显示了周末不可选的日历
<script runat="server">
Sub DaySelect(obj As Object, e As DayRenderEventArgs)
If e.Day.IsWeekend Then
e.Day.IsSelectable = False
End If
End Sub
</script>
<form runat="server">
<form runat="server">The weekends are not selectable
<asp:Calendar id="cal1" runat="server" OnDayRender="DaySelect" />
</form>
ASP.NET CalendarDay IsSelected 属性
ASP.NET CalendarDay IsSelected 属性用于获取日期在 Calendar 控件中是否被选定
如果日期在 Calendar 控件中被选定,则该属性返回 "TRUE",否则返回 "FALSE"
范例
下面的范例显示了被选定的日期是否在当前的月份中
<script runat="server">
Sub DaySelect(obj As Object, e As DayRenderEventArgs)
If e.Day.IsSelected Then
If e.Day.IsOtherMonth = "TRUE" Then
Label1.Text = "NO"
Else
Label1.Text = "YES"
End If
End If
End Sub
</script>
<form runat="server">
<asp:Calendar id="cal1" runat="server" OnDayRender="DaySelect"/>The selected date is in the current month:
<asp:Label id="Label1" runat="server"/>
</form>
ASP.NET CalendarDay IsToday 属性
ASP.NET CalendarDay IsToday 属性用于获取日期是否是当前日期
如果日期是当前日期,则该属性返回 "TRUE",否则返回 "FALSE"
范例
下面的范例显示了被选日期是否是当前日期
<script runat="server">
Sub DaySelect(obj As Object, e As DayRenderEventArgs)
If e.Day.IsSelected Then
If e.Day.IsToday = "TRUE" Then
Label1.Text = "YES"
Else
Label1.Text = "NO"
End If
End If
End Sub
</script>
<form runat="server">
<asp:Calendar id="cal1" runat="server" OnDayRender="DaySelect" />The selected date is in the current month:
<asp:Label id="Label1" runat="server"/>
</form>
ASP.NET CalendarDay IsWeekend 属性
ASP.NET CalendarDay IsWeekend 属性用于获取日期是否是星期六或星期日
如果日期在周末,则该属性返回 "TRUE",否则返回 "FALSE"
范例
下面的范例显示被选的日期是否在周末
<script runat="server">
Sub DaySelect(obj As Object, e As DayRenderEventArgs)
If e.Day.IsSelected Then
If e.Day.IsWeekend = "TRUE" Then
Label1.Text = "YES"
Else
Label1.Text = "NO"
End If
End If
End Sub
</script>
<form runat="server">
<asp:Calendar id="cal1" runat="server" OnDayRender="DaySelect"/>The selected date is in a weekend:
<asp:Label id="Label1" runat="server"/>
</form>
Web 控件标准属性
- AccessKey
- Attributes
- BackColor
- BorderColor
- BorderStyle
- BorderWidth
- CssClass
- Enabled
- Font
- EnableTheming
- ForeColor
- Height
- IsEnabled
- SkinID
- Style
- TabIndex
- ToolTip
- Width
如果想要查看完整描述,可以访问我们的 Web 控件标准属性
控件标准属性
- AppRelativeTemplateSourceDirectory
- BindingContainer
- ClientID
- Controls
- EnableTheming
- EnableViewState
- ID
- NamingContainer
- Page
- Parent
- Site
- TemplateControl
- TemplateSourceDirectory
- UniqueID
- Visible
如果想要查看完整描述,可以访问我们的 控件标准属性