Solved

JavaScript PopUp window.

Posted on 2006-11-08
10
972 Views
Last Modified: 2008-03-04
Dear Experts.

i am using ASp.Net2.0 C#
i have window and i want to open a new small window, when the user close this small window i want the parent window that called this small one to know, without postingBack the parent window, througth JavaScript.

thank you.
0
Comment
Question by:RamyBouchra
10 Comments
 
LVL 15

Expert Comment

by:mattisflones
ID: 17897450
What exactly are you trying to achieve?
0
 
LVL 12

Accepted Solution

by:
renjurdevan earned 250 total points
ID: 17897490

call from client side script , ie if you want to open popup frm a button click

<input type="button" id= "test" onclick="open();">

function open()
{

window.open       (szURL,"mywindow","width=700,height=600,status=0,toolbar=0,scrollbars=0");

}
Here szURL = your url of the popup window. width, height  ,status... all are properties of the popup window.


and in popup window you can capture the onunload event of the body..

on onunload update a variable or hidden field in the parent window like

window.opener.GlobalVariable__Name = 1;

Regards
Renju.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17897494
Sounds like window.open to me.

Bob
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 6

Assisted Solution

by:Niraj_Singh
Niraj_Singh earned 250 total points
ID: 17897738

 hope the code below will be helpful to u...

Include this code on ur parent window

<input type=button
   onClick=window.open("abc.aspx","Ratting","width=550,height=170,left=150,top=200,toolbar=0,status=0,");    
   value="Open Window">

On child window incude the code below....

<html>
<head>
<title>(Type a title for your page here)</title>

<SCRIPT language=JavaScript>
<!--
function win(){
window.opener.location.href="abc.aspx";
self.close();
//-->
}
</SCRIPT>


</head>

<input type=button onClick="win();" value="Close this window">

</body>
</html>

0
 
LVL 3

Expert Comment

by:rugu_16
ID: 17900388
Are you trying to refresh parent window without postback when popup is closed ? then AJAX is the way to go.
0
 

Expert Comment

by:yasir710
ID: 17902511

This can be done by adding a control (hidden html control, textbox control, lable control etc) on your parent page and on the Child window's function win(), assign value to that control as:

function win(){
window.opener.getElementById('txtname').value = "1";
self.close();
}

This will assign a value '1' to the parent's page control without refreshing the it.

Yasir
0
 

Expert Comment

by:yasir710
ID: 17904388

Forgot to add .document. The function win() will be now:

function win(){
window.opener.document.getElementById('txtCtrlname').value = "1";
self.close();
}

here 'txtCtrlname' is the name of the control  (I have used textbox) you have added.

Yasir
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to deploy to IIS 7 on 2008R2 server with DUO 2-step login? 2 52
ASP.net Javascript use multiple sliders 2 29
mail.To.Add 5 26
asp enable view state 1 24
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question