Home   Preview the Book   Chapter 15, TOC   Part 20

  Previous: Implementing a Hybrid Breadcrumb Link Design
  Next: Using Authentication to Vary the Display

Using Session State to Remember Previous Links

To enable a page to determine its predecessor, VB Snippets uses a session-state variable. When the code_browse page processes, for example, it executes the following instructions:

sKeyword = oCode.Keyword
Me.smaccCrumbs.BrowseItem = sKeyword
Session("From") = "B:" & sKeyword

After the page is disposed, the From session-state variable retains a value that identifies the last page active in the session and, in this case, the keyword used to build that particular browse page. Note that this is the same keyword used to set the BrowseItem property of the breadcrumbs control.

When the code_example page executes, it sets the From property equal to the From session-state variable, as in the following code from the Page_Load procedure:

smaccCrumbs.From = CStr(Session("From"))
smaccCrumbs.CurrentPage = "Code"
smaccCrumbs.ResourceManager = rm

The information supplied by this code enables the breadcrumbs control to construct the lists used by the Render method.
In return, the code_example page relies upon information supplied by the breadcrumbs control to set the CurrentIndex property of the navigation menu. The following code, also from the Page_Load procedure, transfers the appropriate index:

Dim ouNav As u_navigate
ouNav = CType(Me.FindControl("smaNav"), u_navigate)
ouNav.CurrentIndex = smaccCrumbs.CodePath

Although we’ve focused on the code_browse page during this discussion, the code_example page also displays the correct breadcrumb links when accessed by other paths. Figure 15-13 shows a screenshot of a code snippet located through the code_search_results page.

Figure 15-13. A visitor can display a code snippet by means of a search page.
Chapter 15, Figure 13.

The visitor in Figure 15-13 can return directly to the search results page that led to this snippet, can skip back to start another search, or can link to another page entirely from the navigation menu.

  Previous: Implementing a Hybrid Breadcrumb Link Design
  Next: Using Authentication to Vary the Display

Home   Preview the Book   Chapter 15, TOC   Part 20

Copyright © 1996 - 2017 SoftMedia Artisans, Inc. All Rights Reserved.