Hi all,
I Got logic for how to add Calendar in panel like this,
In My ASPX page looks Like,
<table>
<tr>
<td>
<asp:label id="Label1" runat="server" text="Start Date:" xmlns:asp="#unknown"></asp:label>
<asp:textbox runat="server" id="txtStart" xmlns:asp="#unknown"></asp:textbox>
<asp:calendar id="Calendar1" runat="server" onselectionchanged="Calendar1_SelectionChanged" xmlns:asp="#unknown">
</asp:calendar>
</td>
<td rowspan="3">
<asp:panel id="pnlContaint" runat="server" height="100%" width="100%" xmlns:asp="#unknown">
</asp:panel>
</td>
</tr>
<tr>
<td>
<asp:label id="Label2" runat="server" text="End Date:" xmlns:asp="#unknown"></asp:label>
<asp:textbox runat="server" id="txtEndDate" xmlns:asp="#unknown"></asp:textbox>
<asp:calendar id="Calendar2" runat="server" onselectionchanged="Calendar2_SelectionChanged" xmlns:asp="#unknown">
</asp:calendar>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:label id="Label3" runat="server" text="Every:" xmlns:asp="#unknown"></asp:label>
<asp:dropdownlist id="DropDownList1" runat="server" xmlns:asp="#unknown">
<asp:listitem value="1">Every</asp:listitem>
<asp:listitem value="2">Every 2nd</asp:listitem>
<asp:listitem value="3">Every 3rd</asp:listitem>
</asp:dropdownlist>
<asp:button id="Button1" runat="server" text="Show" onclick="Button1_Click" xmlns:asp="#unknown" />
</td>
<td>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
</table>
In My Code,
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
txtStart.Text = Calendar1.SelectedDate.ToShortDateString();
}
protected void Calendar2_SelectionChanged(object sender, EventArgs e)
{
txtEndDate.Text = Calendar2.SelectedDate.ToShortDateString();
}
protected void Button1_Click(object sender, EventArgs e)
{
DateTime dtTemp = new DateTime(Calendar1.SelectedDate.Year, Calendar1.SelectedDate.Month, 1);
while (dtTemp < Calendar2.SelectedDate)
{
Calendar cal = new Calendar();
cal.ShowNextPrevMonth = false;
cal.TodaysDate = dtTemp.Date;
cal.DayRender += new DayRenderEventHandler(cal_DayRender);
pnlContaint.Controls.Add(cal);
dtTemp = dtTemp.AddMonths(1);
}
}
void cal_DayRender(object sender, DayRenderEventArgs e)
{
e.Day.IsSelectable = false;
}
But there is one Problem is that how to change Background In Date?
Please Help me...