FrmCalendar.aspx |
<div> <asp:Calendar ID="Calendar1" runat="server" onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar> <hr /> <asp:Label ID="lblDate" runat="server" Text=""></asp:Label> <hr /> <asp:Calendar ID="Calendar2" runat="server" SelectionMode="DayWeekMonth" onselectionchanged="Calendar2_SelectionChanged"></asp:Calendar> <asp:Label ID="lblDates" runat="server" Text=""></asp:Label> <br /> <asp:Calendar ID="Calendar3" runat="server" BackColor="#FFFFCC" BorderColor="#FFCC66" BorderWidth="1px" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="#663399" Height="310px" NextMonthText="다음달" PrevMonthText="이전달" ShowGridLines="True" Width="607px"> <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" /> <SelectorStyle BackColor="#FFCC66" /> <TodayDayStyle BackColor="#FFCC66" ForeColor="White" /> <OtherMonthDayStyle ForeColor="#CC9966" /> <NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" /> <DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" /> <TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" /> </asp:Calendar> </div> |
FrmCalendar.aspx.cs |
protected void Calendar1_SelectionChanged(object sender, EventArgs e) { // 현재 선택된 날짜/시간값을 출력 this.lblDate.Text = Calendar1.SelectedDate.ToLongDateString(); } protected void Calendar2_SelectionChanged(object sender, EventArgs e) { // 현재 선택된 범위의 날짜값을 출력 string s = ""; foreach (DateTime item in Calendar2.SelectedDates) { s += item.ToShortDateString() + "<br />"; } lblDates.Text = s; } |
결과화면 |
[그림23-1] |
'ASP.NET' 카테고리의 다른 글
00.ASP.NET - 기본형 게시판(1) : DB설계 (1) | 2009.10.07 |
---|---|
24.C# ASP.NET - AdRotator 광고컨트롤 [WebStandardControl] (0) | 2009.10.07 |
22.C# ASP.NET - InputControl [WebStandardControl] (0) | 2009.10.07 |
21.C# ASP.NET - HiddenField 컨트롤 [WebStandardControl] (0) | 2009.10.07 |
20.C# ASP.NET - 링크버튼(LinkButton) 컨트롤 [WebStandardControl] (0) | 2009.10.07 |
Comments