473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Help with calendar control.

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?

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" %>
  2. <script language="VB" runat="server">
  3.  
  4.     Dim MyVal1 As Boolean
  5.     Dim SelectedDate As Date
  6.     Dim testt As String
  7.  
  8.     Sub Page_Load()
  9.  
  10.         Try
  11.             MyVal1 = Convert.ToBoolean(Request("checkbox1"))
  12.         Catch
  13.             MyVal1 = True
  14.         End Try  
  15.  
  16.     End Sub
  17.  
  18.     Function GetmyDate() As String
  19.  
  20.         If Calendar1.SelectedDate.Date.ToShortDateString = "1/1/0001" Then
  21.             GetmyDate = Now.ToShortDateString
  22.         Else
  23.             GetmyDate = Calendar1.SelectedDate.Date.ToShortDateString
  24.         End If
  25.  
  26.         Calendar1.VisibleDate = GetmyDate
  27.  
  28.     End Function
  29.  
  30. </script>
  31. <html>
  32. <head id="Head1" runat="server">
  33. </head>
  34. <body scroll="auto">
  35.     <form id="form1" runat="server">
  36.         <strong><span style="font-size: 24pt"> <br /></span></strong>
  37.         <br />
  38.         The Date is: <%= GetmyDate%>
  39.         <br />
  40.         <Img ID="Image1" src="Draw_Pic.ASPX?val1=<%= MyVal1%>&val2=<%= GetmyDate%>" width=768 height=375><br />
  41.         <strong><span style="font-size: 12pt"> <br /></span></strong>
  42.         <strong><span style="font-size: 12pt"> <br /></span></strong>
  43.         <strong><span style="font-size: 12pt"><br /></span></strong>
  44.         <br />
  45.         <asp:CheckBox ID="CheckBox1" runat="server" Font-Size="12pt" style="z-index: 104; left: 121px; position: absolute; top: 539px" />&nbsp; &nbsp;<br />
  46.             <br />         
  47.             <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" >
  48.                 <TodayDayStyle BorderWidth="3px" BackColor="MistyRose" BorderColor="Red" />
  49.                 <DayStyle BorderStyle="Ridge" BorderWidth="1px" BackColor="WhiteSmoke" />
  50.                 <DayHeaderStyle BackColor="DarkGray" BorderStyle="Ridge" BorderWidth="1px" BorderColor="Black" />
  51.                 <TitleStyle Font-Bold="True" BackColor="LightSteelBlue" />
  52.                 <WeekendDayStyle BackColor="#E0E0E0" />
  53.                 <OtherMonthDayStyle BackColor="Silver" BorderColor="DimGray" BorderStyle="Solid"
  54.                     BorderWidth="1px" />
  55.             </asp:Calendar>
  56.         <br />
  57.         <br />
  58.             <asp:Button ID="Button1" runat="server" Text="Button" style="z-index: 110; left: 231px; position: absolute; top: 536px" />
  59.         <br />
  60.         &nbsp;<br />
  61.     </form>
  62.  
  63. </body>
  64. </html>
  65.  
Feb 20 '07 #1
1 1824
jhardman
3,406 Expert 2GB
I may be way off, you write in a bit of a different style than I, but it looks like you load the page and then ask which date is entered. In the getmydate function you need to refer to the date picked on the last screen, not the current one. I would have the link look something like this:
Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim prevDate, nexDate
  3. prevDate = dateAdd("m", -1, date)
  4. nexDate = dateAdd("m", 1, date)
  5. %>
  6. <a href="thispage.asp?myDate=<%=urlEncode(prevDate)%>">&lt;</a>
  7. <a href="thispage.asp?myDate=<%=urlEncode(nexDate)%>">&gt;</a>
  8.  
and then the page that opens it should say:
Expand|Select|Wrap|Line Numbers
  1. dim getMyDate
  2. getMyDate = date
  3. if request("myDate") <> ""  then getMyDate = request("myDate")
  4.  
Feb 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tim Graichen | last post by:
Hello, I am making use of the Active X calendar control (mscal.Calendar.7) in several places in my main form, with the following code Below is an example of the code I'm using for the...
1
by: Gilles T. | last post by:
I have calendar control in Javascript including in the Head of mu page: <script charset="iso-8859-1" language="JavaScript" src="popcalendar.js"></script> I call this calendar popup with a image...
1
by: bill yeager | last post by:
I would like to place the currently selected date (retrieved from the database) on a calendar control which is embedded inside a datagrid. However, I can't find the ID of the control to do so....
0
by: maxrawson | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
2
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
0
by: Pavan | last post by:
Hi Group, I have created a custom calendar control with a layout of TextBox, Html Button & Calendar control. I have a property in the control, which sets or gets selected date of the calendar...
3
by: =?Utf-8?B?UGFycm90?= | last post by:
I applied the following Ajax code in my web page which has a calendar control to keep my page from completely reloading everytime something was changed. <atlas:ScriptManager ID="ScriptManager1"...
7
by: John Kotuby | last post by:
Hi all, I am trying to use a calendar server control which I have ID="Calendar1" in the source code. What I am trying to do is emulate a JavaScript calendar that was being used in an older ASP...
6
by: thorpk | last post by:
I have an access database that i have added a pop up calendar to, the Table information for the Date Reported field is Date/Time format short date, input mask is 00/00/0000. i have created a...
7
by: William (Tamarside) | last post by:
Please, if you have the time and knowledge to help me I'd truly appreciate it! I need to build a calendar page that displays available/unavailable info from a DB and colour a cell according to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.