Calender Control

Aug 12 2009 8:50 AM
Hi every one

i am trying to create a popup calender from that user can select the date and the date on the textbox. I can get the date on my textbox the thing is that i can not select my own date i will show you the code what i did
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox><input type="button" value="..." onclick="OnClick()" /><div id="divCalender" style="display:none; position:absolute;">
                                        <asp:Calendar ID="Calendar1" runat="server" BackColor="#FFFFCC" BorderColor="#FFCC66" BorderWidth="1px" FirstDayOfWeek="Saturday" Font-Names="Verdana" Font-Size="8pt" ForeColor="#663399" Height="200px" ShowGridLines="True" Width="220px" OnSelectionChanged="Test">
                                            <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
                                            <TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
                                            <SelectorStyle BackColor="#FFCC66" />
                                            <OtherMonthDayStyle ForeColor="#CC9966" />
                                            <NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
                                            <DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" />
                                            <TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" />
                                        </asp:Calendar>
                                    </div>
and the java script is

function OnClick()
        {
          
          if( divCalender.style.display == "none")
            divCalender.style.display = "";
          else
            divCalender.style.display = "none";
        }

and the code behind of Onselectionchange is
  protected void Test(object sender, EventArgs e)
{
txtDate.Text = Calendar1.SelectedDate.ToShortDateString();
}

what to do to get a good popup calender control
thanks in advance

Answers (10)