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
i've had a think about the window.open() thing as well and my project
relies on the returned array from showModalDialog() so it can collect
the data into the desired boxes.

do you know if there's any way of calling a page's Dispose() method
from another page? Maybe i could ensure the page is unloaded before I
emit the JavaScript to pop the box up

i'll have another play tomorrow and see what happens

thanks for all your suggestions :)

Tim

 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3JlZWppdGggUmFt?=
Guest
Posts: n/a
 
      08-17-2005
"H00ner" wrote:
> 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


Page loads the previous data, when clicked second time ?

The issue should be BROWSER CACHING the data.. use this code in popup page
page_load to expire the cache..


private void Page_Load(object sender, System.EventArgs e)
{
ExpirePageCache();
//.......rest of the page_load logic....................
}


/// <summary>
/// This function prevent the page being retrieved from broswer cache
/// </summary>
private void ExpirePageCache()
{
Response.Cache.SetCacheability(HttpCacheability.No Cache);
Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0));
Response.Cache.SetLastModified(DateTime.Now);
Response.Cache.SetAllowResponseInBrowserHistory(fa lse);
}



pls let us know if it worked.. Thanks

Sreejith

 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3JlZWppdGggUmFt?=
Guest
Posts: n/a
 
      08-17-2005
an additional note, this happense when you do not have any query parameter
passed (or pass same query param value in susequent calls) to the popup ..

Adding a dummy query parameter param with some random value passed as
parameter every time also could solve the issue..

"Sreejith Ram" wrote:

> "H00ner" wrote:
> > 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

>
> Page loads the previous data, when clicked second time ?
>
> The issue should be BROWSER CACHING the data.. use this code in popup page
> page_load to expire the cache..
>
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> ExpirePageCache();
> //.......rest of the page_load logic....................
> }
>
>
> /// <summary>
> /// This function prevent the page being retrieved from broswer cache
> /// </summary>
> private void ExpirePageCache()
> {
> Response.Cache.SetCacheability(HttpCacheability.No Cache);
> Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0));
> Response.Cache.SetLastModified(DateTime.Now);
> Response.Cache.SetAllowResponseInBrowserHistory(fa lse);
> }
>
>
>
> pls let us know if it worked.. Thanks
>
> Sreejith
>

 
Reply With Quote
 
Curt_C [MVP]
Guest
Posts: n/a
 
      08-17-2005
H00ner wrote:
> i've had a think about the window.open() thing as well and my project
> relies on the returned array from showModalDialog() so it can collect
> the data into the desired boxes.
>
> do you know if there's any way of calling a page's Dispose() method
> from another page? Maybe i could ensure the page is unloaded before I
> emit the JavaScript to pop the box up
>
> i'll have another play tomorrow and see what happens
>
> thanks for all your suggestions :)
>
> Tim
>


save the data, call the calling-pages Refresh() when complete

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
 
Reply With Quote
 
H00ner
Guest
Posts: n/a
 
      08-18-2005
Sreejith

These both worked.

i added a javascript method to return a random generated querystring
which i then appended to my URL in showModalDialog() and this caused
the page to load every time

Also, i tried the Response.Cache() method you gave me and that works
also. i prefer this method to the random querystring as the code is
all server-side and easy to locate

thanks your help on this, problem solved :)

Tim

 
Reply With Quote
 
H00ner
Guest
Posts: n/a
 
      08-18-2005
it's a bit of a weird page in most respects. the page starts by asking
the user to select one of our clients and then goes off to cache the
client's product list so that the popup loads a bit quicker. this
selection also makes visible a whole swath of panels and tables with
fields in them.

Sreejith had the solution up above and it was due to browser caching.
invalidating the cache or tricking the browser into thinking it's a
different link sorted it out :)

I'd like to thank you all for your time on my issue and replying to me.
it's really helped me out

cheers

Tim

 
Reply With Quote
 
Raja Jayabal Raja Jayabal is offline
Junior Member
Join Date: Nov 2008
Posts: 1
 
      11-03-2008
Hi,

If you use window.open() then the parent page will be editable or active.
If you dont want the parent page to be active, then you have to open the pop up using hte below code only

window.showmodal(xxxxxx);

now the question who have is, it's not firing the form load of the pop up page,

for that to happen just write the piece of code at the top of the pop up ASPX page

<% Response.Expires = -1%>

This code should be the first line in the ASPX page of the popup window,

Now when ever the page is loded it will just kill the page add reopen it freshly, so the page load will happen every time you load the popup..

Thanks,

Raja Jayabal.
 
Reply With Quote
 
Val0412 Val0412 is offline
Junior Member
Join Date: Nov 2008
Location: FL
Posts: 1
 
      11-25-2008
^
We've also confirmed that all three work beautifully.

We've decided to go with the single line of code in the aspx page.

This has been a huge help.

Thanks Everyone.
 
Reply With Quote
 
cunhajo cunhajo is offline
Junior Member
Join Date: Aug 2009
Posts: 1
 
      08-04-2009
I found some code on another forum that seems to resolve the very problem you describe. I had the same problem. Modal Form would open firing page load first time, but not subsequent times, and not run code behind, resulting in incorrect data.

I placed the following code in the initial form load of the modal window, and it now runs the form load every time after closing it. I beleive the modal form was possibly being cached, and no really re-opening every time. Now it does. Hope this helps.

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
 
Reply With Quote
 
topraveen topraveen is offline
Junior Member
Join Date: Jul 2010
Posts: 1
 
      07-20-2010
Hi,
please use this the following on your pages asax file.
<%@ OutputCache Duration="1" VaryByParam="*"%>
its works for me very well.

thanks praveen.
 
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