Search code examples
c#asp.net.netvisual-studio-2008web-parts

how to trigger page refresh


I am developing a webpart using VSTS 2008 + C# + .Net 3.5 + IIS 7.0 + ASP.Net. I want to refresh the whole page in my WebPart code, refresh I mean the same effect when user press F5 for browser.

I did not find a solution yet, any ideas?


Solution

  • Do it with javascript:

    <a href="javascript:location.reload(true)">Refresh this page</a>
    

    or if you want it automatically from the webpart, have it output code like this:

    <script>
       window.location.reload(true);
    </script>
    

    (this assumes you're not in a frame)