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
3,981 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now