473,785 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

window.opener lost in postback

Hello everyone,

I have a problem that the window.opener variable is lost once my popup
page has a postback. On multiple pages they address this problem but I
cannot find a correct answer.

This is my situation:

I have a main page which shows invoices. When a user clicks on the
invoices they get a popup where they can alter the invoice which uses
postbacks because of direct changes in the database. Finally the user
can click a button to accept the invoice and then I need to change two
variables on the main page which opened this popup, the new invoice
fee and status (which is based on the button pressed). I dont want any
postbacks on the main page, therefore I simply want to pass these two
variables from the popup to the main page.

However, after a single postback on the popup page the window.opener
variable is gone and lost forever. Now I have seen solutions using
frames but I do not know how to go from there because I also pass some
variables from the main page to the popup.

Hope someone can help me,
Regards Frank

Mar 30 '07 #1
4 8205
"Frank" <f.********@gma il.comwrote in message
news:11******** **************@ n59g2000hsh.goo glegroups.com.. .
Hello everyone,

I have a problem that the window.opener variable is lost once my popup
page has a postback. On multiple pages they address this problem but I
cannot find a correct answer.

This is my situation:

I have a main page which shows invoices. When a user clicks on the
invoices they get a popup where they can alter the invoice which uses
postbacks because of direct changes in the database. Finally the user
can click a button to accept the invoice and then I need to change two
variables on the main page which opened this popup, the new invoice
fee and status (which is based on the button pressed). I dont want any
postbacks on the main page, therefore I simply want to pass these two
variables from the popup to the main page.

However, after a single postback on the popup page the window.opener
variable is gone and lost forever. Now I have seen solutions using
frames but I do not know how to go from there because I also pass some
variables from the main page to the popup.

Hope someone can help me,
Regards Frank
If you are able to capture the variables in the popup then you could get
those in a framepage as well... right?
in the window.onload of one of the frame pages you can use window.parent to
get javascript variables from... the parent...
even after a reload/submit you'll be able to get those but only if the
target of the form submit is 'self' of course...

search for window.parent
(or perhaps window.top to get easy access to the top frame instead of
parent.parent.p arent which I have seen people doing...)
Mar 30 '07 #2
Hi Frank,
However, after a single postback on the popup page the window.opener
variable is gone and lost forever. Now I have seen solutions using
frames but I do not know how to go from there because I also pass some
variables from the main page to the popup.
FWIW this is how I "pass" (tell the details frame to "receive" parameters)
If there is a better way please let me know. It's not very modular but hey
:-)

Main Page (With scrolling select list of Invoices)
=============== =============== ==

detailLoc = parent.frames["entry_deta ils"].location; // Global, set
onload
: : :

function showDetails()
{
if (selectRef.sele ctedIndex == 0) //First line is a Header line
return false;

detailLoc.reloa d(); // Trigger the onload event in the details
form - a bit kludgy?
parent.document .getElementById ("main").rows=" 30px,0px,*"; // Show the
details form
return true;
}

Details Page
========

function load()
{
chan =
parent.frames["cornucopia e"].document.getEl ementById("Corn uCopiae");

try
{
selectRef =
parent.frames["queue_look up"].document.getJo bs.jobList;
getDetails();
}
catch(err)
{initData()};

}

function getDetails()
{
headColor =
parent.frames["cornucopia e"].document.getEl ementById("tors o").style.backg rou
ndColor;

parent.frames["cornucopia e"].document.getEl ementById("tors o").style.backg rou
ndColor = "Silver";
document.displa y.entryNumber.v alue =
selectRef.optio ns[selectRef.selec tedIndex].text.substring (0,
10);
return true;
}

function goBack()
{
selectRef.optio ns[selectRef.selec tedIndex].selected=false ;

parent.frames["cornucopia e"].document.getEl ementById("tors o").style.backg rou
ndColor = headColor;
parent.document .getElementById ("main").rows=" 30px,*,0px";
return;
}

You (I) have to use the try/catch because when the "real" load of the
details page occurs, context and some variables are unavailable but when I
reload() they are.

Cheers Richard Maher

"Frank" <f.********@gma il.comwrote in message
news:11******** **************@ n59g2000hsh.goo glegroups.com.. .
Hello everyone,

I have a problem that the window.opener variable is lost once my popup
page has a postback. On multiple pages they address this problem but I
cannot find a correct answer.

This is my situation:

I have a main page which shows invoices. When a user clicks on the
invoices they get a popup where they can alter the invoice which uses
postbacks because of direct changes in the database. Finally the user
can click a button to accept the invoice and then I need to change two
variables on the main page which opened this popup, the new invoice
fee and status (which is based on the button pressed). I dont want any
postbacks on the main page, therefore I simply want to pass these two
variables from the popup to the main page.

However, after a single postback on the popup page the window.opener
variable is gone and lost forever. Now I have seen solutions using
frames but I do not know how to go from there because I also pass some
variables from the main page to the popup.

Hope someone can help me,
Regards Frank

Mar 31 '07 #3
Thanks Marc and Richard,
I will try to use the frames idea to save the variables. I tried it
once but it didnt work out, guess I'll have to try again!

Regards,
Frank

Apr 6 '07 #4
Help !

Well I tried to use frames. I currently have the mainwindow,
factuurOverzich t which opens a new window onclick, which is a frameset
called: factuurFrameset . In this frameset I pass the variables in the
querystring to the frame inside this frameset and load factuur.aspx
with the variables needed. This goes fine. Also, in the mainwindow
factuurOverzich t I set the opener of the factuurFrameset to
factuurOverzich t. Furthermore, from the frame factuur.aspx I can call
window.top.open er and retreive the opener for factuurOverzich t.

However, after I submit data to factuur.aspx (which is handled in
codebehind), such as for editing e.a., the frames and all still work
but I loose the window.top.open er. What could be wrong?

Regards,
Frank

On 6 apr, 11:37, "Frank" <f.f.nee...@gma il.comwrote:
Thanks Marc and Richard,
I will try to use the frames idea to save the variables. I tried it
once but it didnt work out, guess I'll have to try again!

Regards,
Frank

Apr 8 '07 #5

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

Similar topics

4
3176
by: Andrew Alger | last post by:
ok i have two forms. Customer.aspx and Parent_Searh.aspx. There is a button on Customer.aspx that when executed runs javascript code to open up parent_search as a popup. After the user searches for the parent and finds the proper parent in the datagrid they then click on the accept button in the grid. Then I populate a session variable with the parent ID. I then go back to the main page and have it refresh using: ...
0
1433
by: Todd | last post by:
I am doing some coding in a popup page which is kicked off from a parent page (of course). When clicking on the Save button in the popup, I am attempting to do some validation, save some data, and return a value to a control on the parent page. To do this, I'm coding the validation and saving in the clicked event of the button on the popup. At the end of that event, I use RegisterStartupScript to add javascript to the page that will...
1
2258
by: MrFez | last post by:
I have an webform from which I open a child window to display a calendar. When a date is selected in the calendar window it attempts to set the value of a textbox in the main (parent) window by using the window.opener property to reference the textbox. Everything works fine initially. However if the the main window does a postback and the calendar is re-opened, its window.opener property will always be null. So: BEFORE main window...
5
2516
by: Jay | last post by:
I have a situation where the user clicks on a button in a DataGrid to launch a popup window via javascript. In the popup window the user does some things that result in changes to the underlying database the DataGrid is using as a data source. When the popup window is closed I want to refresh the main window -- i.e., cause a postback to happen. Is this possible?
1
11583
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
4
1921
by: louise raisbeck | last post by:
I have this scenario (simplified) function addnewdata () { check for partial match already in db for information entered by user if (partialmatch succeeds) { open new window aspx page (using javascript) with a datagrid of these partial match records (by doing a sqlcommand using some query string values taken from opener data entered) *** }
0
1203
by: Peter Morris [Droopy eyes software] | last post by:
Hi all I have a form which pops open from my page. This form asks the user to enter some values which are then validated on the server. The problem is that the window.opener seems to be lost after a postback. In FireFox it works fine, setting a form value of window.opener works, but in IE it opens a new window. Can anyone suggest a solution?
1
2654
by: MrFez | last post by:
I have an webform from which I open a child window to display a calendar. When a date is selected in the calendar window it attempts to set the value of a textbox in the main (parent) window by using the window.opener property to reference the textbox. Everything works fine initially. However if the the main window does a postback and the calendar is re-opened, its window.opener property will always be null. So: BEFORE main window...
7
2867
by: MrFez | last post by:
Through some investigation it appears that selecting "Every visit to the page" for the IE caching setting "Check for new version of stored pages" causes the window.opener property of child windows to be set to null after the main page has excuted a postback. Can anyone explain this or at show that I'm wrong ? Is this a bug in IE ?
0
9647
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
10356
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
10161
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
7506
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
6743
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
5390
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...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4058
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
3
2890
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.