Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2006, 04:27 AM
Authorized User
 
Join Date: Feb 2006
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default Propogating changes in child window to parent

Hi,

Need some help about propogating changes from child window to parent window... the simplified scenario is as follows:


I have an ASP.NET page (the parent --> A.aspx) in one IE Window: "A", with a button control and a textbox control.

When I click on the button in "A", it will open a new ASP.NET page (the child --> B.aspx) in a new IE Window: "B", with a drop down list box and a button.

The user will choose the desired option in "B" and then click on the button in "B".

Upon clicking on the button, window "B" will close and the option selected in the drop down list box will be written into the textbox in "A".

How do I do it using ASP.NET? Can I just do it purely with ASP.NET or do I have to do write client side scripts to handle this?


Thanks in advance!

Scripts82
__________________
Scripts82
 
Old September 20th, 2006, 06:00 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I would use Javascript to send the value back to the parent page; the only real way to do this using just .NET would be to set a session variable in B, close that window, refresh A and have it check for the exsistance of the session.

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
 
Old September 20th, 2006, 09:11 AM
Authorized User
 
Join Date: Feb 2006
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok thanks... I'll start looking around that topic to see how to do it...

Scripts82
 
Old September 20th, 2006, 09:18 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You can do it in straight JS but I would probably use a combo of the 2 like this:

string sJavaScript;

sJavaScript += "<script language=javascript>";
sJavaScript += "window.location.opener.href='./somepage.aspx?value=" + ddl.SelectedItem.Value + "';";
sJavaScript += "window.close();";
sJavaScript += "</scr" + "ipt>";
Response.Write(sJavaScript);

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
 
Old September 22nd, 2006, 07:07 AM
Authorized User
 
Join Date: May 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Suppose the id of textbox in parent i.e. A.aspx is txtMyTextBox, the id of DropDownList in child i.e. B.aspx is ddlMyDropDownList and SubmitButton in child is btnSubmit

JavaScript In B.aspx

<script language='javascript'>
function UpdateParent()
{

 var ParentElement = window.opener.document.getElementById('txtMyTextBo x');

 var ChildElement = window.opener.document.getElementById('ddlMyDropDo wnList');

 ParentElement.innerText = ChildElement.options[ChildElement.selectedIndex].value;

 window.close();

}
</script>

In child form i.e. B.aspx add attribute in the code file as

btnSubmit.Attributes.Add("OnClick", "UpdateParent();");



Regards,
Rashida
www.akaas.net





Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing parent window from child window arnabghosh Javascript How-To 1 December 26th, 2007 01:18 AM
Submitting a parent form from a child window in IE livehed Other Programming Languages 0 February 15th, 2007 01:07 PM
closed parent window when opened child window jaiwin Javascript How-To 0 October 8th, 2006 12:54 PM
Accessing a element of parent window in child wind livehed BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 June 28th, 2005 10:26 AM
Close Parent window on opening child window pkdev Javascript How-To 8 April 11th, 2004 12:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.