Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Refresh Parent Page after closing Modal Dialog.

Posted on 2007-03-28
3
Medium Priority
?
3,044 Views
Last Modified: 2007-12-19
Can you make the parent page refresh after you close a modal dialog page? The Modal page is being opened from a click from an Obout treeview.

sHtml = "<span onclick=window.showModalDialog('report.aspx?txtsearch=" & sCaseNum & "',null,'satus:no;dialogWidth:740px;dialogHeight:600;dialogHide:true;help:no;scroll:no')><table cellspacing='0' cellpadding='0' border='0'><tr><td style='width: 75px' >" & sCaseNum & "</td><td style='width: 75px' >" & rTime & "</td><td style='width: 190px' >" & notes & "</td><td style='width: 100px'></td><td style='width: 75px' ><img src='" & HasIncompletedRecordsXImage & "'</tr></table></span>"

The modal page uses this value to retrieve and display a record from the access database. The modal page gets new information from the user and updates the database and then closes.

 I need the treeview to update it's content after this happens. At this point I have to close and restart the page to see the updated data. This is a client request. I am aware that it is much better to just open another page rather than a modal dialog.

Also, if you can't tell. I am fresh out of college and not very experienced  =)

John
0
Comment
Question by:just_joe_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Accepted Solution

by:
zeroxp earned 2000 total points
ID: 18812822
you can do a post back from javascript by using: __doPostBack('target', 'argument');
this will work only when you have the following script on the page, and this script will be generated when you have linkbutton, dropdownlist(auto postback) or similar controls that using a client postback on the form:
<script type="text/javascript">
<!--
var theForm = document.forms['FormID'];
if (!theForm) {
    theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
// -->
</script>
the target and argument you passed by the __doPostBack() can be accessed by server side use Request.Form["__EVENTTARGET"], Request.Form["__EVENTARGUMENT"]
you can use the retureValue property of the modal dialog to get more control over the post back. the return value can be set in the openned page before closed.
for instance:
//In your openned page(dialog page)
<script type="text/javascript">window.returnValue = 'Need Post Back';window.close();</script>

//In your main page
<script type="text/javascript">
function childDialog()
{
   var returnV = window.showModalDialog('report.aspx?txtsearch=" & sCaseNum & "',null,'satus:no;dialogWidth:740px;dialogHeight:600;dialogHide:true;help:no;scroll:no');
   if(returnV == 'Need Post Back')
   {
      __doPostBack('target', 'argument');
   }
   else
   {
      //do something else
   }
}
</script>

BUT, generally i think we shoul avoid using showModalDialog() where possible, because it does not work in browsers other than IE. use a layer in the same form will be an alternative, or you may simply redirect to anther form and redirect back after process.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

618 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