473,396 Members | 1,843 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,396 software developers and data experts.

javascript popup conflict

I'm having a problem with two different javascript controls in my app.
The first chuck of javascript that I pasted into my app is the
client-side calendar control popup which works fine when first used.
The second piece of javascript pasted into the app serves as a data
validation message box that fires after some server-side code executes
(if a certain error condition exists). This action is tied to a
submit button that upon NO error condition would write the data to
SQL. The calendar controls work fine until the other server-side
javascript executes then the calendar controls will pop up but when
you click on a date the window does not go away and the selected date
does not populate the textbox it is assigned to.

NOTE: VS.NET 2003 environment

HTML FROM PAGE THAT UTILIZES CALENDAR POP-UP:

<asp:TextBox id="txtStartDt" runat="server"
Width="85px"></asp:TextBox>
<SPAN id="calBlock1">
<A href="javascript:calendar_window=window.open('/advtravel/calendar.aspx?formname=frmNewTrvlReq.txtStartDt',' calendar_window','width=230,height=230');calendar_ window.focus()"><IMG
height="16" alt="Choose A Log Date" src="images/calendar.gif"
width="18" align="absMiddle" border="0"></A>
</SPAN>

CALENDAR.ASPX HTML:

<HTML>
<HEAD>
<title>Select a date</title>
<script runat="server">
Private Sub cntCalendar_SelectionChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cntCalendar.SelectionChanged

Dim strjscript As String = "<script language=""javascript"">"
strjscript = strjscript & "window.opener." &
HttpContext.Current.Request.QueryString("formname" ) & ".value = '" &
cntCalendar.SelectedDate & "';window.close();"
strjscript = strjscript & "</script" & ">"
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:roundedcorners id="RoundedCorners1" runat="server"
Width="190px" BorderColor="Navy" BorderStyle="Solid" BorderWidth="2px"
CornerHeight="20px" CornerWidth="20px" Height="190px"
BackColor="WhiteSmoke">
<TABLE cellSpacing="0" cellPadding="0" align="center">
<TR>
<TD height="13">
<asp:dropdownlist id="drpCalMonth" Runat="Server" Width="100px"
AutoPostBack="True" OnSelectedIndexChanged="Set_Calendar"
CssClass="calTitle"></asp:dropdownlist>
<asp:dropdownlist id="drpCalYear" Runat="Server"
Width="60px" AutoPostBack="True" OnSelectedIndexChanged="Set_Calendar"
CssClass="calTitle"></asp:dropdownlist>
</TD>
</TR>
<TR>
<TD>
<asp:calendar id="cntCalendar" Runat="Server" Width="100%"
CssClass="calbody" DayStyle-BackColor="LightYellow"
OtherMonthDayStyle-BackColor="White"
OnSelectionChanged="cntCalendar_SelectionChanged" ShowTitle="True"
ondayrender="Calendar_dayrender"></asp:calendar>
</TD>
</TR>
</TABLE>
</cc1:roundedcorners>
</form>
</BODY>
</HTML>

SERVER-SIDE DATA VALIDATION CODE :

Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

StartDate = txtStartDt.Text
EndDate = txtEndDt.Text
startTime = wsdataformat.DDL2Military(ddlStartTime.SelectedVal ue)
EndTime = wsdataformat.DDL2Military(ddlEndTime.SelectedValue )

Select Case EndDate

Case Is < StartDate
Dim strScript As String = "<script
language=Javascript>"
strScript += "alert(""" & "INVALID DATE RANGE." & "\n"
& "\n" & "The END DATE cannot occur before the START DATE." & "\n" &
"\n" & "Please re-enter the dates." & """);"
strScript += "</script>"

If (Not Page.IsStartupScriptRegistered("ErrorScript"))
Then
Page.RegisterStartupScript("ErrorScript",
strScript)
Exit Sub
End If

Case Is = StartDate
If EndTime < startTime Then
Dim strScript As String = "<script
language=Javascript>"
strScript += "alert(""" & "INVALID TIMES." & "\n"
& "\n" & "The END TIME cannot occur before the START TIME." & "\n" &
"\n" & "Please re-enter the TIMES." & """);"
strScript += "</script>"

If (Not
Page.IsStartupScriptRegistered("ErrorScript")) Then
Page.RegisterStartupScript("ErrorScript",
strScript)
End If
Exit Sub
End If
Submit_Validated()

Case Is > StartDate

Submit_Validated()

End Select

End Sub
Any help in regards to this matter would be greatly appreciated.

-Maxwell

****If there is a better way to accomplish either of the tasks
described I would definitely be open to hear about redesign options.
Thanks in advance****
Nov 19 '05 #1
0 1497

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

Similar topics

1
by: Ben Wan | last post by:
I got 2 error from the following code below... 1. I couldn't load up the picture since the picture is at (C:\company\image\largePic.jpg) 2. I got a page error in my 'index.html' when calling...
0
by: malcolm | last post by:
How do I get a web-browser loaded with on-the-fly content and a JavaScript onclick popup function to work? I've embedded an axWebBrowser in my (vb.net) application. The browser starts with...
2
by: Jeannie | last post by:
I have a popup window which is a slideshow of about 7 images. When the popup window loads, the first image is present and then the viewer can select next or previous to scroll through the rest of...
3
by: John Bokma | last post by:
I have two windows in a frame. I want to be able that each can open a pop up window and that the handle to that window can be stored somewhere, so that each can talk to the pop up. is it...
12
by: Mark Fox | last post by:
Hello, I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
4
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a...
1
by: rkagrawal | last post by:
I am not sure if this is the right forum to post about this problem , but , i just want to discuss a problem i recently encountered. I was developing a page in ASP , where i came across a problem....
5
by: voidinutah | last post by:
Hello, I'm new to .NET and was trying to find a solution for having a button control do a post back then execute a javascript function. When the button is clicked a post back occurs to save...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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...

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.