Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 26th, 2004, 01:00 PM
Authorized User
 
Join Date: Aug 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default get popup window value without refresh

Hi;
    My scenario is that i have created window name is parent.aspx . this parent widow have a button i want on click this button a popup window will be open. in popup window user enter something in text box and when he click on save button. popup window will be close and data which he entered in text box show in parent window without window refresh. how i can get popup window value in parent window without refresh.
            i hope someone help me. i will be very thankfull.....

qadeeralvi
__________________
qadeeralvi
 
Old September 26th, 2004, 01:49 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

In the popup, when the save button is clicked add the following line of client-side code, assuming that in the popup the textbox is named "txtChild" in the page's only form and in the parent the texbox is called "txtParent" in the only form:
Code:
self.opener.document.forms[0].elements["txtParent"].value = self.document.forms[0].elements["txtChild"].value;
A little longwinded but should work...



--

Joe
 
Old September 27th, 2004, 01:40 AM
Authorized User
 
Join Date: Aug 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi JOe
when i do according to your code. Error message show. my code is..

private void btnSave_Click(object sender, System.EventArgs e)
{
string strClose = "<script language=javascript> ";
strClose = strClose + "document.Form1.elements ['txtLoginName'].value = self.document.FormChild.elements['txtChild'].value ";
strClose = strClose + " window.opener.location.href='adduser.aspx'";
strClose = strClose + " window.close(); </script>";
RegisterClientScriptBlock("key",strClose);
}

Error message is...
Line: 17
char: 115
Error Expected: ','
Code: 0


qadeeralvi
 
Old September 27th, 2004, 11:56 PM
Authorized User
 
Join Date: Aug 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have still problem kindly help me.......


qadeeralvi
 
Old September 28th, 2004, 12:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Qadeeralvi,
The javascript code you are rendering to the client also needs a ; at the end of the statement.
So you line:
strClose = strClose + "document.Form1.elements ['txtLoginName'].value = self.document.FormChild.elements['txtChild'].value ";
Should be:
strClose = strClose + "document.Form1.elements ['txtLoginName'].value = self.document.FormChild.elements['txtChild'].value; ";
Notice the extra ; at the end of the line, one for the rendered javascript and one for your c# statement.
Also needed in:
strClose = strClose + " window.opener.location.href='adduser.aspx';";




======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old September 28th, 2004, 12:09 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

I think you missed out the ";" in the javascript string...


string strClose = "<script language=javascript> ";
            strClose = strClose + "document.Form1.elements ['txtLoginName'].value = self.document.FormChild.elements['txtChild'].value; ";
            strClose = strClose + " window.opener.location.href='adduser.aspx';";
            strClose = strClose + " window.close(); </script>";
            RegisterClientScriptBlock("key",strClose);

Regards
Ganesh
 
Old August 4th, 2006, 10:49 AM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I'm trying to do something similar, though a few requirements for the page are complicating matters. Hopefully, somebody here can help.

Basically, I have a pair of pages, a parent page and a popup. As with the above, I'm trying to get the popup to return a value to the parent page. Now, here are the complications. I'm using ASP.NET. The parent page uses a repeater to create several instances of a table that has a button to call the popup and a textbox to accept the returned value. The popup displays a gridview with a list of items that are populated at run-time. The user is to select one of these, which then causes the value to be returned and the popup to close. So far, I have code setup to handle the click of an item through the code-behind file. That is, I have a VB function in place that captures the value of the selected item. I just need to pass it back, somehow.

Any help would be greatly appreciated. We've been working on this with little success for a while now and are thoroughly stumped.






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to refresh the popup tmadhavi Javascript How-To 1 December 31st, 2007 04:48 AM
Centering Popup window & Blur Parent window jkusmanto Javascript How-To 0 May 25th, 2007 03:19 AM
Remote Scripting(ASP) popup(js)refresh after sent icecoolcorey Pro Java 3 March 27th, 2007 12:19 AM
Window refresh and window pop up in Java Script Aleksandra Javascript How-To 2 March 2nd, 2007 06:47 PM
refresh the parent window when closing the popup ram_siddinen VS.NET 2002/2003 1 January 30th, 2004 04:05 PM





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