<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown"></asp:textbox>
<asp:calendar id="cal1" runat="server" backcolor="White" bordercolor="Black" xmlns:asp="#unknown">
BorderStyle="Solid" CellSpacing="1" Font-Names="Verdana" Font-Size="9pt"
ForeColor="Black" Height="250px" NextPrevFormat="ShortMonth"
onselectionchanged="Calendar1_SelectionChanged" Width="330px">
<dayheaderstyle font-bold="True" font-size="8pt" forecolor="#333333">
Height="8pt" />
<daystyle backcolor="#CCCCCC" />
<nextprevstyle font-bold="True" font-size="8pt" forecolor="White" />
<othermonthdaystyle forecolor="#999999" />
<selecteddaystyle backcolor="#333399" forecolor="White" />
<titlestyle backcolor="#333399" borderstyle="Solid" font-bold="True">
Font-Size="12pt" ForeColor="White" Height="12pt" />
<todaydaystyle backcolor="#999999" forecolor="White" />
</titlestyle></dayheaderstyle></asp:calendar>
<asp:textbox id="TextBox2" runat="server" xmlns:asp="#unknown"></asp:textbox>
<br />
<asp:calendar id="cal2" runat="server" backcolor="White" bordercolor="Black" xmlns:asp="#unknown">
BorderStyle="Solid" CellSpacing="1" Font-Names="Verdana" Font-Size="9pt"
ForeColor="Black" Height="250px" NextPrevFormat="ShortMonth"
onselectionchanged="Calendar2_SelectionChanged" Width="330px">
<dayheaderstyle font-bold="True" font-size="8pt" forecolor="#333333">
Height="8pt" />
<daystyle backcolor="#CCCCCC" />
<nextprevstyle font-bold="True" font-size="8pt" forecolor="White" />
<othermonthdaystyle forecolor="#999999" />
<selecteddaystyle backcolor="#333399" forecolor="White" />
<titlestyle backcolor="#333399" borderstyle="Solid" font-bold="True">
Font-Size="12pt" ForeColor="White" Height="12pt" />
<todaydaystyle backcolor="#999999" forecolor="White" /> </titlestyle></dayheaderstyle></asp:calendar>
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
DateTime t1 = cal1.SelectedDate;
TextBox1.Text = t1.ToString("dd/MM/yyyy");
}
protected void Calendar2_SelectionChanged(object sender, EventArgs e)
{
Calendar c = new Calendar();
c.SelectedDate = cal1.SelectedDate;
DateTime t2 =cal2.SelectedDate;
if (c.SelectedDate > t2)
{
Page.ClientScript.RegisterStartupScript(GetType(), "popup", "alert('Invalid Date..Please Select date after"+c.SelectedDate+"');", true);
}
else
{
TextBox2.Text = t2.ToString("dd/MM/yyyy");
}
}