c# examples code for web developers.

How to use Calendar in

Calendar Web Server Control

Here I show how we can use Calendar control in Create a web form name CalendarHowToUse.aspx, and then add a Calendar control and a Label control. Here we use OnSelectionChanged event in calendar control. When someone selects a date from Calendar, the Label control shows the selected date.


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">
    protected void Calendar1_SelectionChanged(object sender, System.EventArgs e)
        Label1.Text = "You selected: " +

<html xmlns="">
<head runat="server">
    <title>Calendar example: how to use Calendar in</title>
    <form id="form1" runat="server">
        <asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="Crimson">
        <br /><br />
        <asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged">

Related examples