473,378 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Refreshing parent page from a child page opened as a modal dialog box

Default.aspx is the starting page containing a control(ascx) which has
asp:button control on it. On the button click event it has to open a
new page as a modal control. Since refreshing a page in a dialog box
ended up opening up a new browser window with the aspx page, I read on
a forum that I should use the iframe control and since I have to open
a bunch of pages as diaogboxes, I created a general
page(Container.aspx) which has an iframe control on it, which I then
pass a parameter(pageToGoTo) specifying the aspx page that has to be
opened as a dialogbox.

Sequence of events and code are as follows:

On the default.aspx page I have added a control with a button. On the
button click server side event on that control, I call an aspx page.

string script = String.Format("window.showModalDialog(\"{0}?
pageToGoTo=testWebForm01.aspx\", \"testWebForm01.aspx
\" ,'dialogWidth=520px;dialogHeight=650px;dialogTop=1 25px;dialogLeft=125px;');",
ResolveUrl("~/Container.aspx"));
Page.ClientScript.RegisterStartupScript(GetType(), "test",
script, true);

On the Container.aspx I have an iframe control called frameTest which
I load on Page_Load event as follows

string pageToGoTo = Request.QueryString["pageToGoTo"];
frameTest.Attributes["src"] = pageToGoTo;

This is then able to load the testWebForm01.aspx in the iframe
control.

Now on a button click event on testWebForm01.aspx I want to close the
testWebForm01 form and reload default.aspx so that the control on
default.aspx. I added the following javascript code to
testWebForm01.aspx

function refreshParent()
{
window.opener.location.href = window.opener.location.href;

if (window.opener.progressWindow)
{
window.opener.progressWindow.close()
}
window.close();

// parent.refresh();
// self.close();
}

and called it on the server side button_click event as follows

string script = "refreshParent()";
Page.ClientScript.RegisterStartupScript(GetType(), "test",
script, true);

I keep getting window.opener is null error.

I read on another forum that if we have used showModalDialog method
then window.opener method is not initialized.

I did play around with trying to initialize it but haven't had any
success.

Does anybody have any idea on how refreshing the parent page can be
accomplished? Please let me know.

Thanks

Sumeet
Oct 31 '08 #1
9 4400
On Oct 31, 5:20*pm, Bali <sumeetkb...@gmail.comwrote:
Default.aspx is the starting page containing a control(ascx) which has
Please do not post server side code here.

As for the modal dialogs, your code shouldn't need to do anything
until the dialog is closed (at which time control returns to it.)
Otherwise, why use a modal dialog?

https://developer.mozilla.org/en/DOM...howModalDialog
Nov 1 '08 #2
In comp.lang.javascript message <42cf6e15-d24d-4fde-8831-051355c9b990@o4
g2000pra.googlegroups.com>, Sat, 1 Nov 2008 11:33:23, David Mark
<dm***********@gmail.composted:
>On Oct 31, 5:20*pm, Bali <sumeetkb...@gmail.comwrote:
>Default.aspx is the starting page containing a control(ascx) which has

Please do not post server side code here.
Ignore that. We already have one control freak; we don't want another.

When one has a JavaScript problem, and the JavaScript is closely
associated with other code running on the same or another machine, then
it may well be necessary to see that other code, and perhaps to suggest
or discuss how it needs to be changed. And one might have code running
server-side that one wants to transfer to client-side JavaScript.

--
(c) John Stockton, nr London UK. ??*@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Check boilerplate spelling -- error is a public sign of incompetence.
Never fully trust an article from a poster who gives no full real name.
Nov 2 '08 #3
Dr J R Stockton :
David Mark :
>Bali :
>>Default.aspx is the starting page containing a control(ascx) which has
Please do not post server side code here.

Ignore that.
Nope.
We already have one control freak; we don't want another.
Yes.

--
laurent
Nov 2 '08 #4
David Mark wrote:
On Oct 31, 5:20 pm, Bali <sumeetkb...@gmail.comwrote:
>Default.aspx is the starting page containing a control(ascx) which has

Please do not post server side code here.
That request needs to be restricted to server-side *non-ECMAScript* code and
to code that is seemingly *irrelevant* to the problem at hand; if it turns
out to be relevant later, it can be posted then. The request might also
further need to be restricted to *uncommented* server-side code.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Nov 2 '08 #5
Dr J R Stockton wrote:
When one has a JavaScript problem, and the JavaScript is closely
associated with other code running on the same or another machine, then
it may well be necessary to see that other code, and perhaps to suggest
or discuss how it needs to be changed. And one might have code running
server-side that one wants to transfer to client-side JavaScript.
I second that, however it looks like it is more efficient to post the
server-side code only if absolutely necessary to solve the problem, so not
in the first step. Usually one has a problem with client-side code that may
be generated by server-side code; it would be prudent to identify the
problem with the generated client-side code before identifying the possible,
but not necessary, problem with the generating server-side one.

As for "control freak" it's rather a case of the pot calling the kettle black.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Nov 2 '08 #6
On Nov 2, 11:18*am, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <42cf6e15-d24d-4fde-8831-051355c9b990@o4
g2000pra.googlegroups.com>, Sat, 1 Nov 2008 11:33:23, David Mark
<dmark.cins...@gmail.composted:
On Oct 31, 5:20*pm, Bali <sumeetkb...@gmail.comwrote:
Default.aspx is the starting page containing a control(ascx) which has
Please do not post server side code here.

Ignore that. *We already have one control freak; we don't want another.
Have you lost it? You are supposed to post the *output* of the server
side script (presuming it is not JS.) That isn't my rule (though I do
think it makes sense.)
Nov 3 '08 #7
In comp.lang.javascript message <ad818071-e597-4614-81c5-2462ab144e99@r1
5g2000prh.googlegroups.com>, Sun, 2 Nov 2008 18:52:55, David Mark
<dm***********@gmail.composted:
>On Nov 2, 11:18*am, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
>In comp.lang.javascript message <42cf6e15-d24d-4fde-8831-051355c9b990@o4
g2000pra.googlegroups.com>, Sat, 1 Nov 2008 11:33:23, David Mark
<dmark.cins...@gmail.composted:
>On Oct 31, 5:20*pm, Bali <sumeetkb...@gmail.comwrote:
Default.aspx is the starting page containing a control(ascx) which has
>Please do not post server side code here.

Ignore that. *We already have one control freak; we don't want another.

Have you lost it? You are supposed to post the *output* of the server
side script (presuming it is not JS.) That isn't my rule (though I do
think it makes sense.)
It is the input of the server side script which the programmer needs to
get right. Seeing the output only helps. Trying to solve a half-known
problem is folly. Please grow up.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)
Nov 3 '08 #8
On Nov 3, 3:47*pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <ad818071-e597-4614-81c5-2462ab144e99@r1
5g2000prh.googlegroups.com>, Sun, 2 Nov 2008 18:52:55, David Mark
<dmark.cins...@gmail.composted:
On Nov 2, 11:18*am, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <42cf6e15-d24d-4fde-8831-051355c9b990@o4
g2000pra.googlegroups.com>, Sat, 1 Nov 2008 11:33:23, David Mark
<dmark.cins...@gmail.composted:
On Oct 31, 5:20*pm, Bali <sumeetkb...@gmail.comwrote:
Default.aspx is the starting page containing a control(ascx) which has
Please do not post server side code here.
Ignore that. *We already have one control freak; we don't want another.
Have you lost it? *You are supposed to post the *output* of the server
side script (presuming it is not JS.) *That isn't my rule (though I do
think it makes sense.)

It is the input of the server side script which the programmer needs to
get right. *Seeing the output only helps. *Trying to solve a half-known
problem is folly. *Please grow up.
As I said, it is not my rule. I thought for sure it was in the FAQ.
Perhaps it should be. It makes sense as it is pretty difficult to
spot problems in client side script when it is intermingled with
server side directives.
Nov 4 '08 #9
In comp.lang.javascript message <1ed9d815-47d6-4835-a8c7-e1c7e6e7261c@o4
g2000pra.googlegroups.com>, Mon, 3 Nov 2008 16:05:02, David Mark
<dm***********@gmail.composted:
>
As I said, it is not my rule. I thought for sure it was in the FAQ.
Perhaps it should be. It makes sense as it is pretty difficult to
spot problems in client side script when it is intermingled with
server side directives.
It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE7 FF2 Op9 Sf3
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 4 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: gopal srinivasan | last post by:
I need to know how to close a parent modal window when child modal window opens, also i need to know the syntax for writing document on the modal window on the fly, like what we do in case of...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
by: Samy | last post by:
Hi There, I have a user control with buttons on it which I use on a aspx page (parent page). On a button click, a modal dialog(aspx page) opens up and the user enters some info in the modal dialog...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
3
by: luna | last post by:
i have a parent form which opens a child form, i need to pass a variable back to parent then reload parent so parentopens child, child passes to parent, child closes, parent reloads its only...
4
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if...
1
by: Curious Trigger | last post by:
Hi there, programming with Visual Studio 2005 and ASP.NET 2.0 I want to open a modal dialog from Default.aspx. I searched the net and many newsgroups but I couldn't find any solution. First I...
0
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
1
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.