473,785 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ 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="Javascrip t:AirCode_windo w=window.open('/AdvTravel/AirCode.aspx?fo rmname=document .AdminBookingTD etails.txtTDDpt From','AirCode_ window',
'width=400');Ai rCode_window.fo cus()">Airport Code</A>
</SPAN>
</TD>
<TD>
<asp:TextBox id="txtTDDptFro m" 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_Ite mCommand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
dgdAirCodes.Ite mCommand
Dim strjscript As String = "<script language=""java script"">"
strjscript = strjscript & "window.opener. " &
HttpContext.Cur rent.Request.Qu eryString("form name") & ".value = '" &
Server.UrlEncod e(dgdAirCodes.D ataKeys(e.Item. ItemIndex).ToSt ring) &
"';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:dropdo wnlist id="ddlState" runat="server" Width="136px"
AutoPostBack="T rue"></asp:dropdownlis t><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="Vert ical" CellPadding="3"
BackColor="Whit e" BorderWidth="1p x" BorderStyle="No ne"
BorderColor="#9 99999" AutoGenerateCol umns="False" AllowSorting="T rue"
OnItemCommand=" dgdAirCodes_Ite mCommand">
<FooterStyle ForeColor="Blac k"
BackColor="#CCC CCC"></FooterStyle>
<SelectedItemSt yle Font-Bold="True" ForeColor="Whit e"
BackColor="#008 A8C"></SelectedItemSty le>
<AlternatingIte mStyle
BackColor="Gain sboro"></AlternatingItem Style>
<ItemStyle ForeColor="Blac k"
BackColor="#EEE EEE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="Whit e"
BackColor="#000 084"></HeaderStyle>
<Columns>
<asp:ButtonColu mn Text="Code" DataTextField=" Code"
SortExpression= "Code" HeaderText="Air port Code">
<HeaderStyle HorizontalAlign ="Center" Width="30px"></HeaderStyle>
<ItemStyle HorizontalAlign ="Center"></ItemStyle>
</asp:ButtonColum n>

*****Unnecessar y datagrid details removed********

<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundColumn >
</Columns>
<PagerStyle HorizontalAlign ="Center" ForeColor="Blac k"
Position="TopAn dBottom" BackColor="#999 999"
Mode="NumericPa ges"></PagerStyle>
</asp:datagrid></td>
</tr>
</TABLE>
</form>
</body>
</HTML>

Jul 23 '05 #1
2 2220
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="Javascrip t:AirCode_windo w=window.open('/AdvTravel/AirCode.aspx?fo rmname=document .AdminBookingTD etails.txtTDDpt From','AirCode_ window',
'width=400');Ai rCode_window.fo cus()">Airport Code</A>
</SPAN>
</TD>
<TD>
<asp:TextBox id="txtTDDptFro m" 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.javas cript 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(win Source,'',
'top=300,left=7 00,width=300,he ight=100');

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

*************** *
Popup window (dataWindow.htm l)
*************** *

<!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.valu e =
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... "'Permissio n denied to get property
XULElement.sele ctedIndex' 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
2078
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
1242
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 with the wizard, I select the tutorial file and click Next. On the Select Advanced Options step there is no Writeback option available. The only options I have are: Custom Rollups, Members with data, and Ordering and uniqueness of members. When...
5
11582
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 second links pops up a window in the first popup. The way I have it now is working but with each link the size of the popup window should be different but that doesnt happen how can I solve that problem?
38
5089
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 out what i'm doing wrong, and so far it seems i'm doing it the right way. Here's my code...any suggestions would be appreciated. <script language="javascript"> <!-- window.open("256fx/index.htm", "", "height=400, width=600"); //-->
17
2514
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 offset on the left and top, but does not include a centering option. I'm thinking it would include something like (screen.width-imageWidth)/2; somewhere but not sure how do go about doing this.
7
3228
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 8. Jspw3 opens a popup window (using varname=window.open(...)) but there are now two problems: 1) Opera8 interprets a top,left of 0,0 to be top left of the browser window rather than of the entire screen, unlike the other modern browsers I've...
3
1993
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 += "menubar=no,"; features += "resizable=no,";
11
7346
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 1.7.12 (linux kubuntu). It does work with konqueror. It seems to work with firefox on windows but not with IE (not completly sure though).
7
3675
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 pageA.html 2. User clicks on menu link to open popup.html 3. pageA.html checks if popup.html is already open. It is not, open
0
9645
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
9480
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
10324
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
10147
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
10090
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
7499
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
5380
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...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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.