Wednesday, September 10, 2008

AZGroups Forward/Back Button History and jQuery

 Two very good talks this evening 9 Sep 2008 at AZGroups. Thanks to Rob Bagby for staying behind and keeping the conference room open for us.

Scott Cate talked about a new control in SP1 of ASP.NET 3.5, the server side of an Ajax Forward/Back Button history. Scott's code for this demo and many of his other demos can be downloaded from

The main snippets of wisdom that I took away from this talk were:

  • 2 new (I think that they're new) attributes to the <asp:ScriptManager> tag which EnableHistory (which you need to set to true to enable the history of the back and forward buttons) and EnableSecureHistoryState whch defaults to true and does not need to be set unless you want human readable text to be on the URL and hackable which may be the case for an intranet or other URL's that you would like to enable human hackability.
  • In your page's OnInit() event you need to wire up the ScriptManager's Navigate event handler where the correct page is set on a paged control when you revisit the page using the navigation buttons.
  • The grid's pageindexchanging and sorting events also need to be added as handlers which is where the history points are set.

So to summarize: Set history points while navigating the grid using the sorting or paging controls on the grid. Restore the grid to those history points in the ScriptManager1_Navigate event when using the back and forward buttons.

The link that's produced is a perma-link whether it's the encrypted one or the plain text link and will return you to the correct page and sort setting that the grid had.

Rob Richardson gave a good talk on jQuery. His blog post about this talk which he gave at the Desert Code Camp can be found at jQuery - LINQ to JavaScript. There's a link on that blog post to his slides that can be downloaded.

Snippets of wisdom:


No comments:

Post a Comment