Solved

open a child window on button click without doing any postbacks to parent form and send a value to parent form on closing the child window.  asp.net vb.net

Posted on 2007-12-04
6
4,007 Views
Last Modified: 2008-02-01
how to open a child window without doing any postbacks with parent window and send the value from child window to parent window on closing child window.

examples of this type of windows are found in some sites like

www.microsoft.com
www.asp.net -when posting a quick reply.
0
Comment
Question by:aditya_raj
  • 3
6 Comments
 
LVL 12

Accepted Solution

by:
needo_jee earned 250 total points
ID: 20409139
to open window use
window.open("mytest.aspx,"","",);

to return value from child..

if you have a textbox on parent and from child you can assign value or you can call some parent form js function from child ..

lets supposed you have a close button on child when you click that . it work like this

window.operner.form1.textboxTest.value=document.for1.getElementByID('myChildTextBox').value;
0
 
LVL 5

Assisted Solution

by:pavaneeshkumar
pavaneeshkumar earned 250 total points
ID: 20409142
use window.open("url ") in click event handler. this will cause to open new window without postback
window.open("http://www.google.com")

Open in new window

0
 
LVL 12

Expert Comment

by:needo_jee
ID: 20409158
sorry .. here is more explanation
you may write JS function in ASPX and call where you need to open window..
like <script language="Javascript">
function OpenChildwindow()
{
window.open("mytest.aspx","Child Window"," ");
}

// on the form you have a button .. onclick event of that button you may call above function
OR
directly in button
onclick="Javascript:window.open('test.aspx','test');
thanks
0
 
LVL 12

Expert Comment

by:needo_jee
ID: 20409792
Here is working example for the requirements:
//PopUp.aspx ***************************************
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="popUp.aspx.cs" Inherits="popUp" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script  language ="javascript">
    function setValue()
    {
    opener.form1.Button2.value="From pop form";
    self.close(); 
    }
    </script> 
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input id="Button1" onclick ="setValue();" type="button" value="button" /></div>
    </form>
</body>
</html>
 
//Parent.aspx *****************************************
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Dec04.aspx.cs" Inherits="Dec04" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script language ="javascript">
      function OpenPopUp()
    {
    window.open("popUp.aspx");
    }
    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <input id="Button2" onclick="OpenPopUp();" type="button" value="button" /></div>
    </form>
</body>
</html>

Open in new window

0
 
LVL 1

Expert Comment

by:Computer101
ID: 20632933
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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