?
Solved

ASP.NET,Javascript,Ajax: How to get a string from window.showModalDialog

Posted on 2009-12-22
4
Medium Priority
?
345 Views
Last Modified: 2012-05-08
Hi there,
I would like to know how I can get a string from a modal dialog and use it on the parent form using window.showModalDialog
0
Comment
Question by:karakav
4 Comments
 
LVL 5

Accepted Solution

by:
P_Ramprathap earned 2000 total points
ID: 26102967
When you call showModalDialog you do this:
var oReturnValue = showModalDialog(....);
Within showModalDialog, assuming your textboxes have IDs of "txtForename" and "txtSurname":
<body onbeforeunload="terminate();">
function terminate()
{
  var o = new Object();
  o.forename = document.getElementById("txtForename").value;
  o.surname = document.getElementById("txtSurname").value;
  window.returnValue = o;
}


Ram
0
 
LVL 2

Expert Comment

by:vinodsnair2001
ID: 26102982
you can call the modal dialog page as
var retVal = window.showModalDialog("ShowMailDetail.aspx

and in the modal dialog before closing the window you have to set
returnValue = "your return string should be specified here";
0
 
LVL 14

Expert Comment

by:ajitha75
ID: 26102983
use window.returnValue in the document loaded in showModalDialog window. That can be accessed as a return value of the method call like below

var returnData = window.showModalDialog("test.html");

Thanks
Ajitha
0
 
LVL 4

Author Closing Comment

by:karakav
ID: 31668897
Thanks.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month16 days, 3 hours left to enroll

850 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