Solved

Do postback on parent window

Posted on 2008-06-20
6
500 Views
Last Modified: 2008-06-23
Hi All,

I have aspx page 1 that has gridviews that query the database.  When an action happens I open aspx page 2  using window.showModalDialog(passing some parameters).  From page two i need to be able to click a button and have the parent page (page 1) do a postback (which will refresh the data in the gridviews).

I have been searching the web but havent gotten anything to work.

Any solutions?


0
Comment
Question by:joan2006
  • 3
  • 3
6 Comments
 
LVL 33

Accepted Solution

by:
raterus earned 500 total points
ID: 21834750
Put this script in page1

    <script language="javascript">
            function postback()
            {
            <%= Page.ClientScript.GetPostBackEventReference(this, "") %>
            }
    </script>

Then in page2, run this javascript to postback page1

opener.postback();
0
 

Author Comment

by:joan2006
ID: 21848945
raterus, this does a postback but it not requrying the data or properly refreshing the page.  

Any suggestions?
0
 
LVL 33

Expert Comment

by:raterus
ID: 21849039
I was hoping you'd know what needed to run to do that :-)
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:joan2006
ID: 21849132
Well i had to rebind the data and it worked perfectly, thanks!
0
 

Author Comment

by:joan2006
ID: 21849301
ALSO, this solution did NOT work with javascripts window.showModalDialog .. I had to use window.open().  I wanted to use a modal window to prevent the user from switching back and fourth between browsers but my time is getting limited.

0
 
LVL 33

Expert Comment

by:raterus
ID: 21849659
It does work in Firefox 3.0.  These modal dialogs are fairly "new" so you probably have to use different code for different browsers.  Sorry, but I don't know what works off the top of my head in IE.  Looks like you might be able to catch a return value and call the postback() function based on that, I really don't know.

http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_23501062.html
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now