(i) .ASPX File Content
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!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 with Literal Controls Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Calendar Runat="server" ID="Cal" BorderStyle="Solid" BackColor="White" Width="162px" ForeColor="Black"
CellSpacing="1" Height="113px" Font-Size="9pt" Font-Names="Verdana"
BorderColor="Black" PrevMonthText="Prev" NextMonthText="Next" ShowGridLines="True"
TitleFormat="Month" SelectionMode="DayWeekMonth" OnSelectionChanged="Cal_SelectionChanged" />
<Br>
<asp:Literal ID="Literal1" Runat="server" />
</div>
</form>
</body>
</html>
(ii) .ASPX.CS File Contentusing System;
using System.Data;
using System.Configuration;
using System.Collections;
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 Default2 : System.Web.UI.Page
{
protected void Cal_SelectionChanged(object sender, EventArgs e)
{
try
{
foreach (DateTime date in Cal.SelectedDates)
{
Literal1.Text = " Selected Date is :" + date.ToString("d");
}
}
catch (Exception )
{
throw;
}
}
}
(iii) Output
No comments:
Post a Comment