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

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 2183
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.