Gridview in Updatepanel + back button in .Net 2.0

Hi,

I have a gridview in the updatepanel,now after the data is populated in the grid through async postback,if i hit the back button of the browser the grid returns back to empty.

Anyone has a solution to diable the back button or nothing shoudl happen on the back button click.

Thanks

Abhishek

According to your description ,I would like to suggest you to check the links below for some articles which describe how to enable Back/Forward-Button Support for ASP.NET AJAX UpdatePanel.

http://weblogs.asp.net/scottgu/archive/2006/09/14/Tip_2F00_Trick_3A00_-Enabling-Back_2F00_Forward_2D00_Button-Support-for-ASP.NET-AJAX-UpdatePanel.aspx

http://www.codeproject.com/KB/aspnet/ajaxhistorymanagement.aspx?display=Print

On your ScriptManager, you need to set EnableHistory="true". Then, on the buttons that change from page1 to page 2 (to print page #3), you have to invoke ScriptManager.GetCurrent(Page).AddHistoryPoint("KeyName", value);

This saves the back button history state.

Now you have to override the OnNavigate event of the ScriptManager (or ScriptManagerProxy if your ScriptManager is in a MasterPage). When navigating, you have to restore the user’s previous state manually.

The default behavior of the back button is what you are seeing — it goes to the previous URL loaded in the browser. When you are using UpdatePanels, this URL doesn’t change.

There are a few tutorials about this, here is one:

http://geekswithblogs.net/ranganh/archive/2008/11/17/enabling-the-browserrsquos-back-button-for-grid-view-asp.net-ajax.aspx

You can also google against ScriptManager, EnableHistory, AddHistoryPoint, and OnNavigate.

Managing Browser History Using ASP.NET Server Controls

http://msdn.microsoft.com/en-us/library/cc488548.aspx

Hi Chetan,

Really Appreciate your reply.

But all these changes holds good for .net 3.5 not for .net 2.0.

Please let me know if any thing is possible to be done in .net 2.0

Thanks

Abhishek

Leave a Reply