Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 20th, 2006, 04:27 AM
Authorized User
 
Join Date: Feb 2006
Location: , , Singapore.
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
  #2 (permalink)  
Old September 20th, 2006, 06:00 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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.
  #3 (permalink)  
Old September 20th, 2006, 09:11 AM
Authorized User
 
Join Date: Feb 2006
Location: , , Singapore.
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
  #4 (permalink)  
Old September 20th, 2006, 09:18 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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.
  #5 (permalink)  
Old September 22nd, 2006, 07:07 AM
Authorized User
 
Join Date: May 2006
Location: , , .
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:10 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.