0

I would like to do a full page load when I click a button which is unfortunately within a update panel.

I am okay to use onclick or onclientclick, which means I can use either ASP.NET or JavaScript to perform a full page load.

By full page load I mean the whole page (I know how post back works)

Jim G.
  • 15,141
  • 22
  • 103
  • 166
Mathematics
  • 7,314
  • 25
  • 77
  • 152
  • You could simply redirect back to the same page. This will do a new load - not a postback. – Darren Wainwright May 14 '13 at 15:29
  • 1
    Not if you don't cache the page in the first place. If your page contains information that absolutely must be 'fresh' then you shouldn't be caching it. – Darren Wainwright May 14 '13 at 15:32
  • Do you want to trigger the page load as if it was a new load or a postback? i.e. do you want the stuff inside `if (!IsPostBack){...}` to be ran on the page again? – Mauro May 14 '13 at 15:51

4 Answers4

2

Check out the Triggers of your UpdatePanel. Especialy the asp:PostBackTrigger element might solve your problem like explained there

Marshall777
  • 1,196
  • 5
  • 15
2

why not use an anchor, you could style it to look like a button if needed.

staticly

<a href="SomePage.aspx">Reload</a>

or dynamically

<a href="<%=Request.RawUrl %>">Reload</a>
MikeM
  • 27,227
  • 4
  • 64
  • 80
0

Let's call "full page load" a GET request. GET requests can get cached. We can bypass that cache with CTRL + F5 that allows a no-cache GET request. In your case you need to perform a GET request with no cache and without requiring the user to hit CTRL + F5.

So setup the page with no cache. Then you can fire off GET requests as expected. However, caching behavior is both browser and server dependant (server can ignore no cache), browsers are bugged/behave differently.

Because of this Microsoft has a recommended way of setting up no cache:

<HTML>
<HEAD>
<META HTTP-EQUIV="REFRESH" CONTENT="5">
<TITLE> Pragma No-cache </TITLE>
</HEAD>
<BODY>
This is an example of where to place the second header section<br>
so that the "Pragama, No-Cache" metatag will work as it is supposed to.<br>
</BODY>
<HEAD>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
</HTML>
Community
  • 1
  • 1
P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348
0

Have you tried using response.redirect to the page itself if you really wanted to have a full page load.

Hope this helps.

Mico
  • 117
  • 1
  • 12