블로그 이미지
Magic_kit
study 관련자료를 한곳으로 자기 개발 목적으로 재태크 재무 관리 목적으로 일상생활의 팁을 공유 하기 위하여 블로그를 개설 하였습니다.

calendar

1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28

Category

Recent Post

Recent Comment

Archive

2009. 10. 8. 02:52 .Net Project/ASP.NET 3.5 Sp1
반응형
 Clender.aspx 디자인 모드



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebStandardControl.aspx.cs"
               Inherits="WebForm10월7일_WebStandardControl" %>

<!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</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Calendar ID="Calendar1" runat="server"
            onselectionchanged="Calendar1_SelectionChanged" Height="178px"
            Width="166px"></asp:Calendar>
    <hr />

    <asp:Label ID="lblDate" runat="server" Text="" ForeColor="Red"></asp:Label>
    <asp:Label ID="lblDate2" runat="server" Text="" ForeColor="Red"></asp:Label>
     
    <asp:Calendar ID="Calendar2" runat="server" BackColor="#66CCFF"
            SelectionMode="DayWeekMonth"
            onselectionchanged="Calendar2_SelectionChanged"
                                            Height="98px" Width="119px"> </asp:Calendar>
 
   <asp:Label ID="lblDates" runat="server" Text=""></asp:Label>
      
   <asp:Calendar ID="Calendar3" runat="server" BackColor="White"
            BorderColor="#3366CC" BorderStyle="Groove"
            BorderWidth="1px" CellPadding="1"
            DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
            ForeColor="#003399" Height="118px" Width="171px">
           <SelectedDayStyle BackColor="#009999" Font-Bold="True"
                                                        ForeColor="#CCFF99" />
           <SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
           <WeekendDayStyle BackColor="#CCCCFF" />
           <TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
           <OtherMonthDayStyle ForeColor="#999999" />
           <NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
           <DayHeaderStyle BackColor="#99CCCC"
                                                     ForeColor="#336666" Height="1px" />
           <TitleStyle BackColor="#003399"
                                            BorderColor="#3366CC" BorderWidth="1px" 
            Font-Bold="True" Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
      </asp:Calendar>    
    </div>
    </form>
</body>
</html>




 Clender.aspx.Cs 이벤트 컨트롤 모드

using System;

public partial class WebForm10월7일_WebStandardControl : System.Web.UI.Page
{    

    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        //현재 선택된 날짜값을 출력하고자 한다
        this.lblDate.Text = Calendar1.SelectedDate.ToShortTimeString();
        this.lblDate2.Text = Calendar1.SelectedDate.ToString();
    }
    protected void Calendar2_SelectionChanged(object sender, EventArgs e)
    {
        //현재 선택된 범위의 날짜 값을 출력
        string s = "";
        foreach (DateTime item in Calendar2.SelectedDates)
        {
            s += item.ToShortTimeString() + "<br />"; //Tostring()사용가능 차이는 존재
        }
            lblDates.Text = s;
    }
}




반응형
posted by Magic_kit