Asp Control ASP.Net

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="Default" %>



    Calendar


    
    

      
          SelectionMode="DayWeekMonth" 
      CellPadding="7" 
      CellSpacing="5" 
      DayNameFormat="FirstTwoLetters" 
      FirstDayOfWeek="Monday" 
      NextMonthText="Next >" 
      PrevMonthText="< Prev" 
      ShowGridLines="True" 
      DayStyle-BackColor="White" 
      DayStyle-ForeColor="Black" 
      DayStyle-Font-Names="Arial" 
      OnSelectionChanged="Calendar1_SelectionChanged" 
      OnDayRender="Calendar1_DayRender" 
      OnVisibleMonthChanged="Calendar1_VisibleMonthChanged">
               BackColor="Black" 
        Font-Names="Arial Black" 
        ForeColor="White" />
               BackColor="Cornsilk" 
        Font-Bold="True" 
        Font-Italic="True" 
        Font-Names="Arial"
        ForeColor="Blue" />
               BackColor="Cornsilk" 
        Font-Names="Arial" 
        ForeColor="Red" />
               BackColor="LavenderBlush" 
        Font-Names="Arial" 
        ForeColor="Purple" />
               BackColor="LightGray" 
        Font-Names="Arial" 
        ForeColor="White" />
               BackColor="Cornsilk" 
        Font-Bold="True" 
        Font-Names="Arial" 
        ForeColor="Green" />
               BackColor="DarkGray" 
        Font-Names="Arial" 
        ForeColor="Yellow" />
               BackColor="Gray" 
        Font-Names="Arial Black" 
        ForeColor="White" 
        HorizontalAlign="Left" />
     
      
      
      
      
      
      
      
      
         
            
            
            
         
         
             
         

         
            Day Range
         

         
            
            
         
         
            
            
            
         
      

               Select a month:
            

                                 id= "ddl"
                  AutoPostBack="true"
                  onSelectedIndexChanged = "ddl_SelectedIndexChanged"
                  runat="server">
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
               
            

                                 id="btnTgif"
                  text="TGIF"
                  onClick="btnTgif_Click"
                  runat="server" />
            
Starting DayEnding Day

                                 Width="25"
                  MaxLength="2" />
            

                                 Width="25"
                  MaxLength="2" />
            

                                 text="Apply"
                  onClick="btnRange_Click" />
            

    

    


File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
     if (!IsPostBack)
     {
       Calendar1.VisibleDate = Calendar1.TodaysDate;
       ddl.SelectedIndex = Calendar1.VisibleDate.Month - 1;
     }
     lblTodaysDate.Text = "Today's Date is " + Calendar1.TodaysDate.ToShortDateString();
   }
  protected void Calendar1_SelectionChanged(object sender, EventArgs e)
   {
     lblSelectedUpdate();
     lblCountUpdate();
     txtClear();
   }
  private void lblSelectedUpdate()
  {
    if (Calendar1.SelectedDate != DateTime.MinValue)
      lblSelected.Text = "The date selected is " +
      Calendar1.SelectedDate.ToShortDateString();
  }
  private void lblCountUpdate()
  {
    lblCount.Text = "Count of Days Selected:  " +
      Calendar1.SelectedDates.Count.ToString();
  }
  protected void ddl_SelectedIndexChanged(Object sender, EventArgs e)
  {
    Calendar1.SelectedDates.Clear();
    lblSelectedUpdate();
    lblCountUpdate();
    Calendar1.VisibleDate = new DateTime(Calendar1.VisibleDate.Year,
                Int32.Parse(ddl.SelectedItem.Value), 1);
    txtClear();
  }
  protected void btnTgif_Click(Object sender, EventArgs e)
  {
    int currentMonth = Calendar1.VisibleDate.Month;
    int currentYear = Calendar1.VisibleDate.Year;
    Calendar1.SelectedDates.Clear();
    for (int i = 1; i <= System.DateTime.DaysInMonth(currentYear,currentMonth); i++)
    {
      DateTime date = new DateTime(currentYear, currentMonth, i);
      if (date.DayOfWeek == DayOfWeek.Friday)
        Calendar1.SelectedDates.Add(date);
    }
    lblSelectedUpdate();
    lblCountUpdate();
    txtClear();
  }
  protected void btnRange_Click(Object sender, EventArgs e)
  {
    int currentMonth = Calendar1.VisibleDate.Month;
    int currentYear = Calendar1.VisibleDate.Year;
    DateTime StartDate = new DateTime(currentYear, currentMonth,
                  Int32.Parse(txtStart.Text));
    DateTime EndDate = new DateTime(currentYear, currentMonth,
                 Int32.Parse(txtEnd.Text));
    Calendar1.SelectedDates.Clear();
    Calendar1.SelectedDates.SelectRange(StartDate, EndDate);
    lblSelectedUpdate();
    lblCountUpdate();
  }
  private void txtClear()
  {
    txtStart.Text = "";
    txtEnd.Text = "";
  }
  protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
  {
    if (!e.Day.IsOtherMonth && e.Day.IsWeekend)
      e.Cell.BackColor = System.Drawing.Color.LightGreen;
    if (e.Day.Date.Month == 1 && e.Day.Date.Day == 1)
      e.Cell.Controls.Add(new LiteralControl("
Happy New Year!"));
  }
  protected void Calendar1_VisibleMonthChanged(object sender, MonthChangedEventArgs e)
  {
    if ((e.NewDate.Year > e.PreviousDate.Year) ||
      ((e.NewDate.Year == e.PreviousDate.Year) &&
      (e.NewDate.Month > e.PreviousDate.Month)))
      lblMonthChanged.Text = "My future's so bright...";
    else
      lblMonthChanged.Text = "Back to the future!";
    Calendar1.SelectedDates.Clear();
    lblSelectedUpdate();
    lblCountUpdate();
    txtClear();
  }
}