473,735 Members | 7,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with a custom calendar control

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 [see www.4guysfromrolla.com], buttons and
panels) functions like a tab control. The buttons are
programmaticall y designed to make the corresponding panel visible.

Sample aspx.vb code:

Private Sub btnEvent_Click( ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnEvent.Click

pnlEvent.Visibl e = True
pnlHotel.Visibl e = False
pnlTravel.Visib le = False
pnlPerDiem.Visi ble = False
pnlOther.Visibl e = False

End Sub

Private Sub btnHotel_Click( ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnHotel.Click

pnlHotel.Visibl e = True
If chkhSpouse.Chec ked = True Then
pnlSpouseData.V isible = True
Else
pnlSpouseData.V isible = False
End If

If chkhCCHold.Chec ked = True Then
txthCCHoldAmt.V isible = True
lblhCCHoldAmt.V isible = True
Else
txthCCHoldAmt.V isible = False
lblhCCHoldAmt.V isible = False
End If
pnlTravel.Visib le = False
pnlPerDiem.Visi ble = False
pnlOther.Visibl e = False
pnlEvent.Visibl e = False

End Sub

Private Sub btnTravel_Click (ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnTravel.Click

pnlEvent.Visibl e = False
pnlHotel.Visibl e = False
pnlTravel.Visib le = True
pnlPerDiem.Visi ble = False
pnlOther.Visibl e = False

End Sub

Private Sub btnPerDiem_Clic k(ByVal sender As System.Object, ByVal
e As System.EventArg s) Handles btnPerDiem.Clic k

pnlEvent.Visibl e = False
pnlHotel.Visibl e = False
pnlTravel.Visib le = False
pnlPerDiem.Visi ble = True
pnlOther.Visibl e = False

End Sub

Private Sub btnOther_Click( ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnOther.Click

pnlEvent.Visibl e = False
pnlHotel.Visibl e = False
pnlTravel.Visib le = False
pnlPerDiem.Visi ble = False
pnlOther.Visibl e = True

End Sub

On each of these panels there are buttons that link to a calendar
control (Calendar.aspx) . Each button passes a textbox name to the
calendar control so that when a date is selected this value is passed
back to the corresponding text box.

Sample Button HTML Code:

<SPAN id="calBlock1"> <A
href="javascrip t:calendar_wind ow=window.open( '//localhost/advtravel/calendar.aspx?

formname=AdminB ooking.txteStar tDt','calendar_ window','width= 230,height=230' );calendar_wind ow.focus()"><IM G
id="eStartDtCal " height="22" alt="Choose an event start date"
src="images/calendar.gif" align="absMiddl e" border="0"></A></SPAN>

Sample Calendar.aspx HTML:

<%@ Register TagPrefix="cc1" Namespace="Pret tyUI" Assembly="Prett yUI"
%>
<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Cal endar.aspx.vb" smartnavigation ="true"
Inherits="AdvTr avel.Calendar" %>
<HTML>
<HEAD>
<title>Select a date</title>
<script runat="server">
Private Sub cntCalendar_Sel ectionChanged(B yVal sender As
System.Object, ByVal e As System.EventArg s) Handles
cntCalendar.Sel ectionChanged
Dim strjscript As String = "<script language=""java script"">"
strjscript = strjscript & "window.opener. " &
HttpContext.Cur rent.Request.Qu eryString("form name") & ".value = '" &
cntCalendar.Sel ectedDate & "';window.close ();"
strjscript = strjscript & "</script" & ">" 'Don't Ask, Tool
Bug
Literal1.Text = strjscript

End Sub
</script>
<asp:literal id="Literal1" Runat="server"> </asp:literal>
<LINK href="http://localhost/AdvTravel/CSS/calendar.css"
type="text/css" rel="stylesheet ">
</HEAD>
<BODY bgcolor="silver ">
<form id="frmCalendar " runat="server">
<cc1:roundedcor ners id="RoundedCorn ers1" runat="server"
Width="210px" BorderColor="Na vy" BorderStyle="So lid"
BorderWidth="2p x" CornerHeight="2 0px" CornerWidth="20 px"
Height="210px" BackColor="Whit eSmoke">
<TABLE cellSpacing="0" cellPadding="0" >
<TR>
<TD height="13">
<asp:dropdownli st id="drpCalMonth " Runat="Server" Width="100px"
CssClass="calTi tle" OnSelectedIndex Changed="Set_Ca lendar"
AutoPostBack="T rue"></asp:dropdownlis t>
<asp:dropdownli st id="drpCalYear " Runat="Server" Width="60px"
CssClass="calTi tle" OnSelectedIndex Changed="Set_Ca lendar"
AutoPostBack="T rue"></asp:dropdownlis t></TD>
</TR>
<TR>
<TD>
<asp:calendar id="cntCalendar " Runat="Server" Width="100%"
CssClass="calbo dy" ondayrender="Ca lendar_dayrende r"
ShowTitle="True "
OnSelectionChan ged="cntCalenda r_SelectionChan ged"
OtherMonthDaySt yle-BackColor="Whit e"
DayStyle-BackColor="Ligh tYellow"></asp:calendar></TD>
</TR>
</TABLE>
</cc1:roundedcorn ers></form>
</BODY>
</HTML>

This functionality works well on the first visible panel on the page
however, soon as I click on a new "tab" to make a different panel
visible the the calendar functionality no longer works. The calendar
will pop-up but when a date is selected the calendar.aspx pop-up does
not close and does not write the value back to the corresponding text
field.

NOTE: There is a animated .gif on the page that also hangs when the
javascript fails.

I must conclude with first, an apology for the long-winded
explaination to my problem and second, a thank you in advance to
anyone willing to assist a newbie in trying to find a fix to this
problem.
Nov 18 '05 #1
2 3413
I know that IE stops animating a gif when it considers the page submitted. I
think that javascript continues to run until the page hits its unload stage.
So I'm not sure why javascript stops for you.

May I make a suggestion for an entirely different approach? ASP.NET has a
very rich collection of third party controls for almost anything you'd like.
Some are even free. In fact, the date entry controls segment has around 20
items to offer, plus several articles posted on popular ASP.NET sites. With
date controls, most offer a popup calendar that avoids the second window
(which is usually blocked by popup blockers and has other UI shortcomings).
Instead, they use lots of javascript to show and hide a TABLE or DIV
containing a calendar that does not post back each time you click. (The
ASP.NET calendar always posts back.) The third party controls can be found
on these sites: www.asp.net Control Gallery, www.123aspx.com, and
www.411asp.net. I am the author of one, "Peter's Date Package",
http://www.peterblum.com/datecontrols/home.aspx.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Caesar Augustus" <ma*******@yaho o.com> wrote in message
news:92******** *************** ***@posting.goo gle.com...
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 [see www.4guysfromrolla.com], buttons and
panels) functions like a tab control. The buttons are
programmaticall y designed to make the corresponding panel visible.

Sample aspx.vb code:

Private Sub btnEvent_Click( ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnEvent.Click

pnlEvent.Visibl e = True
pnlHotel.Visibl e = False
pnlTravel.Visib le = False
pnlPerDiem.Visi ble = False
pnlOther.Visibl e = False

End Sub

Private Sub btnHotel_Click( ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnHotel.Click

pnlHotel.Visibl e = True
If chkhSpouse.Chec ked = True Then
pnlSpouseData.V isible = True
Else
pnlSpouseData.V isible = False
End If

If chkhCCHold.Chec ked = True Then
txthCCHoldAmt.V isible = True
lblhCCHoldAmt.V isible = True
Else
txthCCHoldAmt.V isible = False
lblhCCHoldAmt.V isible = False
End If
pnlTravel.Visib le = False
pnlPerDiem.Visi ble = False
pnlOther.Visibl e = False
pnlEvent.Visibl e = False

End Sub

Private Sub btnTravel_Click (ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnTravel.Click

pnlEvent.Visibl e = False
pnlHotel.Visibl e = False
pnlTravel.Visib le = True
pnlPerDiem.Visi ble = False
pnlOther.Visibl e = False

End Sub

Private Sub btnPerDiem_Clic k(ByVal sender As System.Object, ByVal
e As System.EventArg s) Handles btnPerDiem.Clic k

pnlEvent.Visibl e = False
pnlHotel.Visibl e = False
pnlTravel.Visib le = False
pnlPerDiem.Visi ble = True
pnlOther.Visibl e = False

End Sub

Private Sub btnOther_Click( ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnOther.Click

pnlEvent.Visibl e = False
pnlHotel.Visibl e = False
pnlTravel.Visib le = False
pnlPerDiem.Visi ble = False
pnlOther.Visibl e = True

End Sub

On each of these panels there are buttons that link to a calendar
control (Calendar.aspx) . Each button passes a textbox name to the
calendar control so that when a date is selected this value is passed
back to the corresponding text box.

Sample Button HTML Code:

<SPAN id="calBlock1"> <A
href="javascrip t:calendar_wind ow=window.open( '//localhost/advtravel/calendar.aspx?

formname=AdminB ooking.txteStar tDt','calendar_ window','width= 230,height=230' );calendar_wind ow.focus()"><IM G
id="eStartDtCal " height="22" alt="Choose an event start date"
src="images/calendar.gif" align="absMiddl e" border="0"></A></SPAN>

Sample Calendar.aspx HTML:

<%@ Register TagPrefix="cc1" Namespace="Pret tyUI" Assembly="Prett yUI"
%>
<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Cal endar.aspx.vb" smartnavigation ="true"
Inherits="AdvTr avel.Calendar" %>
<HTML>
<HEAD>
<title>Select a date</title>
<script runat="server">
Private Sub cntCalendar_Sel ectionChanged(B yVal sender As
System.Object, ByVal e As System.EventArg s) Handles
cntCalendar.Sel ectionChanged
Dim strjscript As String = "<script language=""java script"">"
strjscript = strjscript & "window.opener. " &
HttpContext.Cur rent.Request.Qu eryString("form name") & ".value = '" &
cntCalendar.Sel ectedDate & "';window.close ();"
strjscript = strjscript & "</script" & ">" 'Don't Ask, Tool
Bug
Literal1.Text = strjscript

End Sub
</script>
<asp:literal id="Literal1" Runat="server"> </asp:literal>
<LINK href="http://localhost/AdvTravel/CSS/calendar.css"
type="text/css" rel="stylesheet ">
</HEAD>
<BODY bgcolor="silver ">
<form id="frmCalendar " runat="server">
<cc1:roundedcor ners id="RoundedCorn ers1" runat="server"
Width="210px" BorderColor="Na vy" BorderStyle="So lid"
BorderWidth="2p x" CornerHeight="2 0px" CornerWidth="20 px"
Height="210px" BackColor="Whit eSmoke">
<TABLE cellSpacing="0" cellPadding="0" >
<TR>
<TD height="13">
<asp:dropdownli st id="drpCalMonth " Runat="Server" Width="100px"
CssClass="calTi tle" OnSelectedIndex Changed="Set_Ca lendar"
AutoPostBack="T rue"></asp:dropdownlis t>
<asp:dropdownli st id="drpCalYear " Runat="Server" Width="60px"
CssClass="calTi tle" OnSelectedIndex Changed="Set_Ca lendar"
AutoPostBack="T rue"></asp:dropdownlis t></TD>
</TR>
<TR>
<TD>
<asp:calendar id="cntCalendar " Runat="Server" Width="100%"
CssClass="calbo dy" ondayrender="Ca lendar_dayrende r"
ShowTitle="True "
OnSelectionChan ged="cntCalenda r_SelectionChan ged"
OtherMonthDaySt yle-BackColor="Whit e"
DayStyle-BackColor="Ligh tYellow"></asp:calendar></TD>
</TR>
</TABLE>
</cc1:roundedcorn ers></form>
</BODY>
</HTML>

This functionality works well on the first visible panel on the page
however, soon as I click on a new "tab" to make a different panel
visible the the calendar functionality no longer works. The calendar
will pop-up but when a date is selected the calendar.aspx pop-up does
not close and does not write the value back to the corresponding text
field.

NOTE: There is a animated .gif on the page that also hangs when the
javascript fails.

I must conclude with first, an apology for the long-winded
explaination to my problem and second, a thank you in advance to
anyone willing to assist a newbie in trying to find a fix to this
problem.

Nov 18 '05 #2
I have not noticed that animated gifs stop being animated when the page is
loaded. It will set there an animate for hours.

"Peter Blum" <PL****@Blum.in fo> wrote in message
news:OQ******** ******@TK2MSFTN GP11.phx.gbl...
I know that IE stops animating a gif when it considers the page submitted.
I think that javascript continues to run until the page hits its unload
stage. So I'm not sure why javascript stops for you.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2208
by: Judy | last post by:
How do I create a combobox in a custom menubar to display months like: 1 January 2 February 3 March etc and then assign the month number (1, 2, 3, etc) of the selected month to a textbox on a form? Thanks for all help!
0
7655
by: Mike Pierson | last post by:
Hello all: I have a C# windows application that needs a custom calendar. I need this calendar displayed as a month view. I also need the ability to insert/manipulate images and text into each day cell. I will also need drag and drop functionality for each item in the day. I figure there is two ways to go about this; 1) create a user control for use in a windows form or 2) use a web page in a web browser control. Which method would...
1
2709
by: charliewest | last post by:
Is it possible to use the custom validation control to validate a calendar control via client-side script (in jscript)? I'm familiar with custom validation and client side script, and i am aware that the custom control cannot be wired automatically to the calendar control, but i cannot seem to "read" the value of the calendar control via jscript via any other means. Any ideas?
8
3191
by: Tinus | last post by:
Hello all, I've create a custom control (UserControl) and have a custom Item Collection. The control is a custom calendar which is draw using the Graphics Rectangle etc. functions. It is drawn when the control is painted or resized. When the control is drawn it draws also the items found in the collection. So far so good.... I have 3 questions which I'm unable to find a solution
9
2153
by: Matt Tapia | last post by:
I having a problem that receives the following error: Specified cast is not valid And I need some help. Here is what is happening: I have a form with a drop-down control that contains a list of control names (TextBox, DropDownList, Calendar). On Post back of this drop-down control, I clear a panel control (I have on the same page) of all its controls, then dymamically add the selected control to the panel. For example, if in ddl
2
1719
by: Marc Robitaille | last post by:
Hello, I built myself a calendar control. I want the control to be able to be validated by .NET validation controls. So I added the ValidationPropertyAttribute("Text") to my class declaration of my calendar control. It is the Text property of my control which must be validated. I add a CompareValidator control to my web page and I adjust the properties of this control to validate my calendar control. I use a CompareValidator to ensure...
4
3928
by: rushikesh.joshi | last post by:
Hi All, I want to create custom control by using Web.UI.WebControls.Calendar, in which I want to set few days with different color. I had created two property to set the color and storing in viewstate. I had created 4 methods to Add/Remove my special dates in viewstate. Up to here all seems perfect, but how do I used it in prerender event for my new calendar control.
0
1104
by: Damian | last post by:
I have created a custom calendar control for use in a VS 2005 wizard, which consists of a label, a textbox and a calendar control. When I select a date on the calendar control the textbox is updated with the date. If i move to a new wizardstep and select a date on the custom calendar control and select a date on one of the custom controls on that step I lose the instance of the custom calender control on the first wizard step. I...
8
3923
by: Radu | last post by:
Hi. I have an ASP control on my page: <asp:Calendar ID="calStart" ................ Etc </asp:Calendar> and I have a Custom Validator defined as <asp:CustomValidator
0
8785
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
9463
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9200
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6747
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
6049
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4559
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...
1
3273
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
2
2739
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2188
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.