473,485 Members | 1,479 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Popup window writeback problem

Greetings all:

I have an asp.net application that is coded mainly in vb.net. I have
successfully cut and pasted some javascript into my application that
mimicks the datetime picker control in vb. I wanted to try to use that
same code for another popup style window that displays a list of
airport codes in a datagrid. The desired results would be that when an
airport code (the datagrid's key field) is clicked the value would
write back to the parent page's textbox.

So far I have been able to get the popup window to display but when I
click on an airport code in the datagrid the window does not close nor
does the value write back to the parent page control.

Parent page HTML that opens the popup:

<TD>
<SPAN id="aircode1">
<A style="FONT-SIZE: xx-small"
href="javascript:AirCode_window=window.open('/AdvTravel/AirCode.aspx?formname=document.AdminBookingTDetail s.txtTDDptFrom','AirCode_window',
'width=400');AirCode_window.focus()">Airport Code</A>
</SPAN>
</TD>
<TD>
<asp:TextBox id="txtTDDptFrom" runat="server"></asp:TextBox>
</TD>

Popup window HTML that displays the airport codes and is supposed to
writeback the code:

<HTML>
<HEAD>
<title>US Airport Codes</title>
<script runat="server">
Private Sub dgdAirCodes_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
dgdAirCodes.ItemCommand
Dim strjscript As String = "<script language=""javascript"">"
strjscript = strjscript & "window.opener." &
HttpContext.Current.Request.QueryString("formname" ) & ".value = '" &
Server.UrlEncode(dgdAirCodes.DataKeys(e.Item.ItemI ndex).ToString) &
"';window.close();"
strjscript = strjscript & "</script" & ">" 'Don't Ask, Tool Bug
Literal2.Text = strjscript
End Sub
</script>
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form id="AirCode" method="post" runat="server">
<TABLE width="400">
<tr>
<td><asp:dropdownlist id="ddlState" runat="server" Width="136px"
AutoPostBack="True"></asp:dropdownlist><asp:textbox id="Literal2"
runat="server"></asp:textbox></td>
</tr>
<tr>
<td>
<asp:datagrid id="dgdAirCodes" runat="server" PageSize="50"
Font-Size="XX-Small" GridLines="Vertical" CellPadding="3"
BackColor="White" BorderWidth="1px" BorderStyle="None"
BorderColor="#999999" AutoGenerateColumns="False" AllowSorting="True"
OnItemCommand="dgdAirCodes_ItemCommand">
<FooterStyle ForeColor="Black"
BackColor="#CCCCCC"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#008A8C"></SelectedItemStyle>
<AlternatingItemStyle
BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle ForeColor="Black"
BackColor="#EEEEEE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#000084"></HeaderStyle>
<Columns>
<asp:ButtonColumn Text="Code" DataTextField="Code"
SortExpression="Code" HeaderText="Airport Code">
<HeaderStyle HorizontalAlign="Center" Width="30px"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>

*****Unnecessary datagrid details removed********

<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black"
Position="TopAndBottom" BackColor="#999999"
Mode="NumericPages"></PagerStyle>
</asp:datagrid></td>
</tr>
</TABLE>
</form>
</body>
</HTML>

Jul 23 '05 #1
2 2195
ma*******@yahoo.com wrote:
Greetings all:

I have an asp.net application that is coded mainly in vb.net. I have
successfully cut and pasted some javascript into my application that
mimicks the datetime picker control in vb. I wanted to try to use that
same code for another popup style window that displays a list of
airport codes in a datagrid. The desired results would be that when an
airport code (the datagrid's key field) is clicked the value would
write back to the parent page's textbox.

So far I have been able to get the popup window to display but when I
click on an airport code in the datagrid the window does not close nor
does the value write back to the parent page control.

Parent page HTML that opens the popup:

<TD>
<SPAN id="aircode1">
<A style="FONT-SIZE: xx-small"
href="javascript:AirCode_window=window.open('/AdvTravel/AirCode.aspx?formname=document.AdminBookingTDetail s.txtTDDptFrom','AirCode_window',
'width=400');AirCode_window.focus()">Airport Code</A>
</SPAN>
</TD>
<TD>
<asp:TextBox id="txtTDDptFrom" runat="server"></asp:TextBox>


Instead of posting your ASP code, post the code that the browser gets.
Then its a simple matter of copy/pasting to test it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2
ma*******@yahoo.com wrote:
Greetings all:

I have an asp.net application that is coded mainly in vb.net. I have
successfully cut and pasted some javascript into my application that
mimicks the datetime picker control in vb. I wanted to try to use that
same code for another popup style window that displays a list of
airport codes in a datagrid. The desired results would be that when an
airport code (the datagrid's key field) is clicked the value would
write back to the parent page's textbox.

So far I have been able to get the popup window to display but when I
click on an airport code in the datagrid the window does not close nor
does the value write back to the parent page control.


Here is a trivial example:

****************
Parent window
****************

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Window returns values</title>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
// tgtElement: element to update (is also caller here)
// winSource : the URL of the resource to load
// theWindow : window object reference
var theWindow;
function openWindow(tgt,winSource) {
theWindow = window.open(winSource,'',
'top=300,left=700,width=300,height=100');

// create a reference to the element to update in the
// popup window
theWindow.tgtElement = tgt;
}
</script>
</head>
<body onload="this.window.name = 'robWin';">
<form name="winOpener">
<input type="text" name="dataField" onclick="
openWindow(this,'dataWindow.html');
">
<input type="reset" value="reset" onfocus="blur();">
</form>
</body>
</html>

****************
Popup window (dataWindow.html)
****************

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Data window</title>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
</head>
<body>
<form action="">
<select name="data">
<option value="option01" selected>Option 01</option>
<option value="option02">Option 02</option>
<option value="option03">Option 03</option>
</select>
<input type="button" value="Accept selected value" onclick="
tgtElement.value =
this.form.data[this.form.data.selectedIndex].value;
window.close();
">
</form>
</body>
</html>
The only caveat is that opening a window this way in Firefox
creates an error:

Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method: ...

But the script runs OK. I can't find out how to prevent the
error. IE seems quite happy.
--
Rob
Jul 23 '05 #3

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

Similar topics

1
2060
by: Marco Bubke | last post by:
Hi If I do shelve.open(filename='prim', protocol=pickle.HIGHEST_PROTOCOL, writeback=True) I get on some maschines(its the some python): Traceback (most recent call last):
0
1224
by: Ryan | last post by:
Hello. I am working on an OLAP tutorial for Data Analysis in SQL Server 2000. I have worked through nearly 2 full tutorials and came across a problem. When trying to create a Parent-Child Dimension...
5
11567
by: Willem van Isselmuden | last post by:
Hello, I've a problem I hava a page with different popup windows, when I hit a link the first one pops up and with the first open i would like to hit the second link in the parent page so the...
38
4999
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find...
17
2489
by: Applebrownbetty | last post by:
Hi, I'd like to append/amend the following code from the Dreamweaver extension "Open Picture Window Fever" for the ability to center the PopUp window: By default, it allows the window to be...
7
3194
by: E Michael Brandt | last post by:
I have been lurking here for some time, and now would like to ask a question of you clever coders: My JustSo PictureWindow 3 Extension for Dreamweaver has stumbled in the face of the new Opera...
3
1977
by: ypress | last post by:
Hi. I have a page that contains this simple function: <script language="javascript"> function openPop(url, name, w, h) { var features = ""; features += "scrollbars=no,"; features +=...
11
7318
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz...
7
3645
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
0
6960
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
7161
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...
1
6825
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
7275
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...
0
5418
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4857
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...
0
4551
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...
0
3063
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
595
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.