Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET Javascript Modal Popup won't fire Page Load on second go

Reply
Thread Tools

ASP.NET Javascript Modal Popup won't fire Page Load on second go

 
 
H00ner
Guest
Posts: n/a
 
      08-17-2005
Hello All

Hope you can help

Been pulling my hair out about a popup problem in ASP.NET. One of the
forms i wrote requires the user to select a product from a list in a
popup web form. the popup has a DataGrid on it and the page.load
function DataBinds as you'd expect.

I have Code-Behind in C# to emit a call to a JavaScript function which
uses showModalDialog() to show the popup. The product list is selected
from the parent page and inserted into a Session[] variable. This
Session[] variable is picked up by the popup and binds to the datagrid
successfully. A little more JavaScript is emitted in the popup to get
an array of data back to the parent, and also call window.close().

However, when the user has to select a second product, the popup
doesn't fire it's Page.load method and the DataGrid remains with it's
old data. The data is definitely in the Session[] store as i expected
it.

How can i get the popup to close properly so that the page.load event
fires every time?

hope it makes sense

 
Reply With Quote
 
 
 
 
Curt_C [MVP]
Guest
Posts: n/a
 
      08-17-2005
> How can i get the popup to close properly so that the page.load event
> fires every time?
>


Not sure but I think the window.open() call has an attribute to name the
opening window (for ref) and if so try generating a random name (time
perhaps) as the name to ensure it's a "new" window...

Just a quick thought

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
 
Reply With Quote
 
 
 
 
Grant Merwitz
Guest
Posts: n/a
 
      08-17-2005
if i've understood this properly, you are trying to get the Parent page to
reload once you have finished with the popup window.

If this is the case, as well as closing the popup, try redirect the Parent
page to itself

JavaScript: window.opener.parent.location='MyUrl.aspx';

HTH





"H00ner" <> wrote in message
news: oups.com...
> Hello All
>
> Hope you can help
>
> Been pulling my hair out about a popup problem in ASP.NET. One of the
> forms i wrote requires the user to select a product from a list in a
> popup web form. the popup has a DataGrid on it and the page.load
> function DataBinds as you'd expect.
>
> I have Code-Behind in C# to emit a call to a JavaScript function which
> uses showModalDialog() to show the popup. The product list is selected
> from the parent page and inserted into a Session[] variable. This
> Session[] variable is picked up by the popup and binds to the datagrid
> successfully. A little more JavaScript is emitted in the popup to get
> an array of data back to the parent, and also call window.close().
>
> However, when the user has to select a second product, the popup
> doesn't fire it's Page.load method and the DataGrid remains with it's
> old data. The data is definitely in the Session[] store as i expected
> it.
>
> How can i get the popup to close properly so that the page.load event
> fires every time?
>
> hope it makes sense
>



 
Reply With Quote
 
Grant Merwitz
Guest
Posts: n/a
 
      08-17-2005
and just found on google, you can also do:

JavaScript: window.opener.location.reload()

"H00ner" <> wrote in message
news: oups.com...
> Hello All
>
> Hope you can help
>
> Been pulling my hair out about a popup problem in ASP.NET. One of the
> forms i wrote requires the user to select a product from a list in a
> popup web form. the popup has a DataGrid on it and the page.load
> function DataBinds as you'd expect.
>
> I have Code-Behind in C# to emit a call to a JavaScript function which
> uses showModalDialog() to show the popup. The product list is selected
> from the parent page and inserted into a Session[] variable. This
> Session[] variable is picked up by the popup and binds to the datagrid
> successfully. A little more JavaScript is emitted in the popup to get
> an array of data back to the parent, and also call window.close().
>
> However, when the user has to select a second product, the popup
> doesn't fire it's Page.load method and the DataGrid remains with it's
> old data. The data is definitely in the Session[] store as i expected
> it.
>
> How can i get the popup to close properly so that the page.load event
> fires every time?
>
> hope it makes sense
>



 
Reply With Quote
 
H00ner
Guest
Posts: n/a
 
      08-17-2005
I saw that option of window.open() but, unfortunately, I'm using
window.showModalDialog() which returns a variant from the modal box and
not a reference to the page.

thanks for the reply though Curt :¬)

 
Reply With Quote
 
Curt_C [MVP]
Guest
Posts: n/a
 
      08-17-2005
Grant Merwitz wrote:
> if i've understood this properly, you are trying to get the Parent page to
> reload once you have finished with the popup window.
>


Actually I think he's indicating that the second time he tries to call
the window.open() it doesnt.... because he suspects it isnt closing
properly??

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
 
Reply With Quote
 
H00ner
Guest
Posts: n/a
 
      08-17-2005
thanks Grant, but it's not the parent that needs to be reloaded.

The process works like this :

Parent window selects data to be displayed in popup and stores in
session
Parent emits javascript to call showModalDialog() and popup loads
Popup gets data from session and binds to datagrid
User selects data they want and popup returns a JavaScript array
Parent uses javascript array to fill text boxes

This all works okay on the first run through, but the popup will not
fire it's Server-Side Page.Load method when it's called a Second time
and the new data selected by the parent isn't bound to the DataGrid.
It seems that the popup page is still 'loaded' and the JavaScript
window.close() doesn't unload it entirely

 
Reply With Quote
 
Curt_C [MVP]
Guest
Posts: n/a
 
      08-17-2005
H00ner wrote:
> I saw that option of window.open() but, unfortunately, I'm using
> window.showModalDialog() which returns a variant from the modal box and
> not a reference to the page.
>
> thanks for the reply though Curt :¬)
>


I'm not really concerned with the return from the call, more of the
actual call. I was just wondering if the browser was seeing the same
call twice and not calling it.. was thinking that an appended
QueryString random value or new name may "fool" the browser into
thinking its a different window.

Personally I've avoided the modal windows due to the NASTY problems I
always run into. A well placed/positioned window.open() call is usually
sufficient. It is definitely an area that WWW has a deficiency in.


--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
 
Reply With Quote
 
H00ner
Guest
Posts: n/a
 
      08-17-2005
You could be on to something there Curt. I was trying to force the
users to give me the data using a modal dialog box. However, i could
use a window.open() instead really as this does give a reference to the
window i've opened which i should be able to nullify when i'm done

thanks for your feedback (and you, Grant) on my issue. I'll update
this thread with my findings using window.open() instead of
window.showModalDialog()

You're also right about the deficiancy thing as well. i'm hoping
there's something to help us more when ASP.NET 2.0 emerges :¬)

cheers

Tim

 
Reply With Quote
 
Curt_C [MVP]
Guest
Posts: n/a
 
      08-17-2005
> You're also right about the deficiancy thing as well. i'm hoping
> there's something to help us more when ASP.NET 2.0 emerges :¬)
>


Sadly its not a programming limitation that much.. mostly its a Browser
thing. WWW wasn't really designed around the idea of multiple,
interconnected, windows. It was supposed to be a single call, processed
and returned then dropped. Everything beyond that is really just
"project drift"......

-
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening modal page from modal page Don ASP .Net 0 05-27-2008 11:49 PM
When accessing second page from an application, Page Load doesn't fire. lawrence.farrell@gmail.com ASP .Net 0 11-30-2006 07:14 PM
Page load of the parent page called twice when a modal dialog is opened from a button click of the user control on the parent page Samy ASP .Net 2 08-15-2005 03:30 PM
showing modal popup window after page load Brian Henry ASP .Net 2 07-05-2004 08:19 AM
Re: showing modal popup window after page load Phil Winstanley [Microsoft MVP ASP.NET] ASP .Net 2 07-04-2004 09:54 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57