I am trying to use the calander control to pick a date and retrieve information from a database. When a date is clicked on, the page re-loads, with the selected date, gets the informatino from the database and creates a graph. The problem that I am having is that when you pick the "<" or ">" to navigate to a new month the page reloads with the current month. How do I get around this?
Code:
<%@ Page Language="VB" %> <script language="VB" runat="server"> Dim MyVal1 As Boolean Dim SelectedDate As Date Dim testt As String Sub Page_Load() Try MyVal1 = Convert.ToBoolean(Request("checkbox1")) Catch MyVal1 = True End Try End Sub Function GetmyDate() As String If Calendar1.SelectedDate.Date.ToShortDateString = "1/1/0001" Then GetmyDate = Now.ToShortDateString Else GetmyDate = Calendar1.SelectedDate.Date.ToShortDateString End If Calendar1.VisibleDate = GetmyDate End Function </script> <html> <head id="Head1" runat="server"> </head> <body scroll="auto"> <form id="form1" runat="server"> <strong><span style="font-size: 24pt"> <br /></span></strong> <br /> The Date is: <%= GetmyDate%> <br /> <Img ID="Image1" src="Draw_Pic.ASPX?val1=<%= MyVal1%>&val2=<%= GetmyDate%>" width=768 height=375><br /> <strong><span style="font-size: 12pt"> <br /></span></strong> <strong><span style="font-size: 12pt"> <br /></span></strong> <strong><span style="font-size: 12pt"><br /></span></strong> <br /> <asp:CheckBox ID="CheckBox1" runat="server" Font-Size="12pt" style="z-index: 104; left: 121px; position: absolute; top: 539px" /> <br /> <br /> <asp:Calendar ID="Calendar1" runat="server" Font-Names="Arial" Font-Size="12pt" Height="200px" Width="200px" BackColor="WhiteSmoke" BorderColor="Black" BorderWidth="3px" DayNameFormat="FirstLetter" EnableViewState="False" style="z-index: 105; left: 12px; position: absolute; top: 570px" > <TodayDayStyle BorderWidth="3px" BackColor="MistyRose" BorderColor="Red" /> <DayStyle BorderStyle="Ridge" BorderWidth="1px" BackColor="WhiteSmoke" /> <DayHeaderStyle BackColor="DarkGray" BorderStyle="Ridge" BorderWidth="1px" BorderColor="Black" /> <TitleStyle Font-Bold="True" BackColor="LightSteelBlue" /> <WeekendDayStyle BackColor="#E0E0E0" /> <OtherMonthDayStyle BackColor="Silver" BorderColor="DimGray" BorderStyle="Solid" BorderWidth="1px" /> </asp:Calendar> <br /> <br /> <asp:Button ID="Button1" runat="server" Text="Button" style="z-index: 110; left: 231px; position: absolute; top: 536px" /> <br /> <br /> </form> </body> </html>
Comment