Hi,
I'm using the calendar control on my webpage. The pop up works fine, however when I select the a date the pop does return the value selected to the text box ... it doesn't seem to do anything.
can anyone help??
Here's the code on aspx page:
Actual Calendar aspx:
Thanks for any help
I'm using the calendar control on my webpage. The pop up works fine, however when I select the a date the pop does return the value selected to the text box ... it doesn't seem to do anything.
can anyone help??
Here's the code on aspx page:
Code:
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DateReceived") %>'></asp:TextBox>
<a href="javascript:calendar_window=window.open('Calendar.aspx?formname=
RegAC.TextBox1','calendar_window','width=164,height=188');
calendar_window.focus()">Calendar</a>
</EditItemTemplate>
Actual Calendar aspx:
Code:
<asp:Calendar id="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged" OnDayRender="Calendar1_DayRender" showtitle="true" DayNameFormat="FirstTwoLetters" SelectionMode="Day" BackColor="#ffffff" FirstDayOfWeek="Monday" BorderColor="#000000" ForeColor="#00000" Height="60" Width="120">
</asp:Calendar>
<asp:Literal id="Literal1" runat="server"></asp:Literal>
{/CODE}
Code behind the Calendar.aspx form:
[CODE]
public partial class Calendar : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
string strjscript = "<script language='javascript'>";
strjscript += "window.opener." + HttpContext.Current.Request.QueryString["formname"];
strjscript += ".value = '" + Calendar1.SelectedDate.ToString("d") + "';window.close();";
strjscript += "</script" + ">"; //Don't ask, tool bug.
Literal1.Text = strjscript;
}
protected void Calendar1_DayRender(Object source, DayRenderEventArgs e)
{
if (e.Day.Date.ToString("d") == DateTime.Now.ToString("d"))
{
e.Cell.BackColor = System.Drawing.Color.LightGray;
}
}
}
Thanks for any help