473,803 Members | 3,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebApp Parent/Child windows

Hello All,
I'm working on a web app that will simulate a Windows app.

One of the items that I've trouble reproducing is the parent/child
interaction that might occur between a windo and popup custom dialog
box (example: right click an item and bring up a Config/Properties
dialog of the selected item).

In a Windows app, I can add a handler in the Parent to respond to the
"OK" event in the child window so that I can update the object's
poprties and reflect any changes on the parent Window.

In the web app, I haven't been able to figure out how to hook into the
PropertyPage's "OK" event from the parent window. It seems that once I
generate a "var propPage = window.open(..) " script, that the only link
between the two windows is the "window.ope ner" property or the
"propPage" variable. Even then, this is a javascript relationship, not
a .NET relationship.

Currently, to simulate the parent/child interaction, I currently do
this (more or less):
1.Pop up the config page (in a small window)
2. Get the user's selections
3. Store the user's selections in the Session
4. Refresh the parent
5. Parent loads, and scans the Session for the config info
6. Parent reflects any config changes on original form.
7. Parent clears the session variable that the child set.

Is there a better way to do this?

All ideas are welcome and appreciated.

-tomas
Nov 16 '05 #1
1 2260
Hi Tomas,
There are a lot of options. It sounds like what you want to do is
POST the settings dialog and then refresh the parent. If this is the
case, then open the dialog window, keeping the window handle in a var
(like I believe you already have). Then keep polling the the dialog
window to see if it has closed... When the dialog page has closed,
then post the original window back to .Net manually. The code I've
provided below is completely self-contained on the Parent window.
There are lots of other ways to do it, hope this helps you find your
final solution.
-Jerry

// CODE for IE and Mozilla
// Variable to hold settings dialog window handle
var subWin = "";
// will hold the timeout
var tmCheck = "";
// initialize type var
var myTypeS = typeof subWin;

// function to open dialog and prep
function ChangeSettings( ) {
// open the new win
subWin = window.open("my page.html","set tingsDlg","tool bar=no,location =no,status=no")
;
// this is for Netscape
subWin.NSVar = 1;
//
window.onfocus = TimeRefreshThis Window;
}

// function that sets timeout to check dialog
function TimeRefreshThis Window() {
tmCheck = setTimeout("Che ckDialog()",800 );
}

// dummy function
function Nothing() {}

// function to check if dialog has closed
function CheckDialog() {
var myTypeS = typeof subWin.document ;
// Has the dialog closed?
if ( ( navigator.userA gent.indexOf("I E") && myTypeS != "object" )
|| ( navigator.userA gent.indexOf("N S") && subWin.NSVar != 1 ) ) {
// bring the focus back to parent (me)
window.focus();
// refresh me (.Net must be expecting this pseudo postback,
handle it in your Page Load event or pass a control id to link it to
an event)
__doPostBack("< %=Me.ClientID%> :myControlId"," ") ;
// to avoid errors
window.onfocus = Nothing;
} else {
// the child still exists, make sure it has focus
subWin.focus();
}
}

// this function closes the dialog if the parent is closed
function CheckDlgOrphan( ) {
var myTypeS = typeof subWin.document ;
if (myTypeS == "object") {
subWin.close();
}
}
// set onunload
onunload = CheckDlgOrphan;
Nov 16 '05 #2

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

Similar topics

5
27604
by: Paul | last post by:
Hi all, Here is what I am trying to do. I have a parent class calling a child class. when one function in child class is called, i need to call parent class' function. How can I get parent class' pointer? Thx Paul
3
9710
by: Maheshkumar.R | last post by:
Hi groups, How i can command over the MDI CHIlD forms created dynamically at runtime from PARENT. Let say, i have generated 5 mdichild forms, but i want to work with child form1 from MDI parent menu functions. if i select draw line in MDI parent, the line should be drawn in current active child..any URLS for this or guide me to achieve this communication... -- Mähésh Kumär. R
4
4181
by: Steve | last post by:
I have the MDI MFC application ported to .NET. Now this application include mixed managed/unmanaged code. The application displays progress dialog with the cancel button during lenghtly operation. This progress dialog implemented as modeless to allow user to cancel the lenghtly operation if he wishes. At the same time I disable mainframe window to prevent user from clicking on the menu bar. Here is the segment of the code:
1
1963
by: Bill Borg | last post by:
Hello all, Simple chat app, where the site owner has a master window with all requests for chat, status of each room, etc., and child windows for each separate chat in which the owner is engaged. When the owner closes one of his child windows, I want to update the master window. I understand "reasonably" well how to go about this. The master window launches the children, and maintains an associative array to keep track of each one....
10
4030
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
3
2696
by: Eddie | last post by:
If FormMain = MDI parent, FormSub = Child parent, I execute FormSub from the menu like this way. FormSub^ sub = gcnew FormSub; sub->MdiParent = this; sub->Show(); This can generate child form sub in FormMain. In th FormMain, there is status bar label named statusBar; I'd like to add code in the sub form that can access statusBar of parent
2
2760
by: epaetz | last post by:
Is there a way to decouple the linkage between a parent and a child window? Does the parent window have any sort of a collection that holds all the children that it has spawned? I want to break that connection from the parent side or the child side, it doesn't matter as long as the communication link is completely broken. I don't want the parent to be aware of the child and vice-versa.
3
18721
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however, working with complex reports is tricky Assumption: Reader of this article have basic knowledge of creating data reports. Creating a Parent-Child Command and create a DataReport Suppose we have a database called company with two tables ...
6
2519
by: SQACSharp | last post by:
I'm using the EnumChildWindows API with an EnumChildWndProc callback to populate the treeview. The output will be something similar to spy+ + How can I specify the parent when adding a new node ?? When adding a new node is there any way to get an handle or something else to be able add the childs to the correct parent ? Thanks!
0
9700
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
9564
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
10310
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...
0
10068
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9121
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6841
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
5498
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
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
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

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.