?
Solved

How do I get a page to bind when the page is loaded when the browser back button is clicked  In asp.net c#

Posted on 2011-02-25
4
Medium Priority
?
320 Views
Last Modified: 2013-12-17
How do I get a page to bind when the page is loaded when the browser back button is clicked  
0
Comment
Question by:bmanmike39
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 2000 total points
ID: 34986306
Back button click of browser is cannot be directly identified by any way as it is a client side browser button event! Even can't be identified by client side script.
When you click Back button, browser just reloads the previous page's rendered HTML - No events are triggered for this browser button click event.
To be more clear, IE Back button is completely independent of the content of your page.

Since there are no direct methods to acheive this, you can try some alternative methods
One option is disable the caching, so that even on click back button previous page will not load

Or

BUT YOU CAN CATCH PAGE UNLOAD EVENT USING JQUERY, when user clicks on IE back button

This method - I already tested and working fine.

The above link says about showing a message box. Instead of the message box, you need to place a dummy button in your aspx page . Put you page_load codes into a function. Call that function in page_load. Call the same function in dummy button click (this button should be hidden)

Hope this helps!
Raj
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34986326
From the link that I posted above.
Attached the js files that I modified for my purpose
 jquery.js
 navigateaway.js
 navigateaway.min.js
// Javascript file references in ASPX Page
    <script language="javascript" type="text/javascript" src="js/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="js/navigateaway.min.js"></script>

Open in new window


// Dummy button
.....
 <asp:Button id="Dummybtn" runat="server" style="display:none;" />
    </form>

Open in new window

// Code-Behind Button click event

 Protected Sub Dummybtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Dummybtn.Click
        pageLoadCodes()
    End Sub

Open in new window


If you check inside navigateaway.min.js file , you can see the code
$('#Dummybtn').trigger('click');

Open in new window

which calls the button click

I tried to explain the steps that I done to reduce your learning process. Not sure whether I missed anything.

Raj
0
 

Author Closing Comment

by:bmanmike39
ID: 34987571
Thanks!
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34988122
Glad I could help!
Raj
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question