MonthChangedEventArgs.PreviousDate 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨트롤에 이전에 표시된 월 Calendar 을 결정하는 날짜를 가져옵니다.
public:
property DateTime PreviousDate { DateTime get(); };
public DateTime PreviousDate { get; }
member this.PreviousDate : DateTime
Public ReadOnly Property PreviousDate As DateTime
속성 값
에 의해 이전에 표시된 월을 결정하는 날짜입니다 Calendar.
예제
다음 코드 예제에서는 속성의 NewDate 월과 PreviousDate 속성을 비교하여 컨트롤이 한 달 앞으로 이동했는지 아니면 한 달 뒤로 이동했는지를 Calendar 확인하는 방법을 보여 줍니다.
<%@ Page Language="C#" AutoEventWireup="True" %>
<!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> Calendar VisibleMonthChanged Example </title>
<script runat="server">
void MonthChange(Object sender, MonthChangedEventArgs e)
{
if (e.NewDate.Month > e.PreviousDate.Month)
{
Message.Text = "You moved forward one month.";
}
else
{
Message.Text = "You moved backwards one month.";
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h3> Calendar VisibleMonthChanged Example </h3>
Select a different month on the calendar.
<br /><br />
<asp:Calendar id="Calendar1" runat="server"
OnVisibleMonthChanged="MonthChange">
<WeekendDayStyle BackColor="gray">
</WeekendDayStyle>
</asp:Calendar>
<hr />
<table border="1">
<tr style="background-color:Silver">
<th>
Month navigation direction
</th>
</tr>
<tr>
<td>
<asp:Label id="Message"
Text="Starting month."
runat="server"/>
</td>
</tr>
</table>
</form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<!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> Calendar VisibleMonthChanged Example </title>
<script runat="server">
Sub MonthChange(sender As Object, e As MonthChangedEventArgs)
If e.NewDate.Month > e.PreviousDate.Month Then
Message.Text = "You moved forward one month."
Else
Message.Text = "You moved backwards one month."
End If
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<h3> Calendar VisibleMonthChanged Example </h3>
Select a different month on the calendar.
<br /><br />
<asp:Calendar id="Calendar1" runat="server"
OnVisibleMonthChanged="MonthChange">
<WeekendDayStyle BackColor="gray">
</WeekendDayStyle>
</asp:Calendar>
<hr />
<table border="1">
<tr style="background-color:Silver">
<th>
Month navigation direction
</th>
</tr>
<tr>
<td>
<asp:Label id="Message"
Text="Starting Month."
runat="server"/>
</td>
</tr>
</table>
</form>
</body>
</html>
설명
컨트롤에 이전에 표시된 월 Calendar 을 확인하려면 이 속성을 사용합니다. 속성을 .로 Calendar 설정하여 이전에 표시된 월로 컨트롤을 VisibleDate 복원할 PreviousDate수 있습니다.
이 날짜는 일반적으로 이전에 표시된 월의 첫 번째 날짜입니다. 그러나 프로그래밍 방식으로 월 내의 날짜로 변경할 수 있습니다.
이벤트가 VisibleDate 발생하기 전에 속성이 이 속성의 날짜로 VisibleMonthChanged 업데이트됩니다.