473,769 Members | 6,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with calendar control.

7 New Member
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 1833
jhardman
3,406 Recognized Expert Specialist
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
3673
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 controls. Private Sub DateSold_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) SoldCal.Visible = True
1
1675
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 link button and working very good: <asp:Textbox CssClass="edit_item" id="txtEditDernieresResolutions" runat="server" width="80"/> <a href='javascript:showCalendar(frmForm.imgDernieresResolutions,...
1
2160
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. During the "Edit" command of the grid, I have the following code: <code> If e.CommandName = "Edit" Then Dim myDatagridItem As DataGridItem Dim lblStartDate As Label Dim lblEndDate As Label
0
1746
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 controls (i.e. roundedcorners component www.4guysfromrolla.com], buttons and panels) functions like a tab control. The buttons are programmatically designed to make the corresponding panel visible. Sample aspx.vb code:
2
3417
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 controls (i.e. roundedcorners component www.4guysfromrolla.com], buttons and panels) functions like a tab control. The buttons are programmatically designed to make the corresponding panel visible. Sample aspx.vb code:
0
1067
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 control (This is server side property). Now i have implemented the control in a way that user can alter the selected date of the control on client side (I have used java script for this) and the
3
2634
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" runat="server" EnablePartialRendering="true"/> <atlas:UpdatePanel runat="server" ID="UpdatePanel1" Mode="Conditional"> <ContentTemplate> After inserting this code, my calendar stopped working in that if I clicked on a date, nothing would...
7
2371
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 version of the application. The javascript version worked nicely -- you click on a calendar.gif in an anchor next to a textbox. The calender would pop up in a new window, you select the date, the calendar window would close and the textbox would be...
6
1960
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 combo box on the form and have bound the control to the Date Reported field. I have placed the calendar control on the form and set the Visible property to no. The following code has bee added to the Mouse Down Event of the Date
7
2303
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 that info, but somewhere I've gone completely off the rails! Basically it is a room availability page for an intranet and should simply colour a calendar cell red if the room is booked, or green if it isn't. Rooms are typically booked by lecturers...
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10050
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9999
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7413
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.