This is a migrated thread and some comments may be shown as answers.

RadGrid and back button navigate problem

1 Answer 300 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jure
Top achievements
Rank 1
Jure asked on 06 Jul 2011, 02:30 PM
Hey!

I have a simple solution, but i am encountering some problems.

On my page I have 2 grids: rgItems and rgDeletedItems.

Columns in rgItems are: ItemName, ItemDetails (which is a link to a page with item details) and Delete (a button that deletes an item). In my DataBase Item has a property IsDeleted, so I delete it just by setting that property. When you click the button the IsDeleted property is set to true and I call rebind() on both grids (that is how I triger the needdatasource and grids refresh).

Columns in rgDeletedItems are: ItemName and button Renew (this button sets IsDelete to false and rebinds both grids, and that is how I move an item back to rgItems).

So in rgItems are Items with IsDeleted == true and in rgDeletedItems are items with IsDeleted = false.

Everyhing works well so far.

Let's make a scenario. We have 3 items RedItem, GreenItem and BlueItem, they are not deleted (IsDeleted == true on all of them), so when we come to page they are all in rgItems, the grid rgDeletedItems is emtpy. Let's say we delete RedItem. So in rgItems we now have 2 items, GreenItem and BlueItem and in grid rgDeletedItems we have RedItem. Then we click on a link on top grid let's say we look at the details of GreenItem, the page opens and everything is fine.
The problem is: when we click back in our browser to go back to the page with grids, initial grid will be loaded (3 item in rgItems and no items in rgDeletedItems), however if we refresh the page everything will be fine again. So the thing is that the back button loads the page that happend on first pageload (!IsPostBack), and it doesn't remember any of the changes that were made after.

Is this possible to make it so, the Page_Load would fire even when you click Back/Forward buttons in browser?

I am thankful for any assistance you can provide.

Sincerely, Jure

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 11 Jul 2011, 04:31 PM
Hi Jure,

You can overcome the issue with the back browser button by implementing the browser history through the ScriptManager. You can use the below articles for a reference:

http://dotnetslackers.com/articles/aspnet/AFirstLookAtASPNETExtensions35HistoryPoints.aspx
http://msdn.microsoft.com/en-us/library/cc488548.aspx

The same approach can be used if you have RadScriptManager instead of ScriptManager.

Best wishes,
Pavlina
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Jure
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or