Page navigation

Users can navigate around the portal using the Menu FDF without any underlying scripting. Other types of navigation, for example, clicking on a URL or item number to navigate to a page with more details, require the use of the scripting APIs.

NavigateTo or NavigateToSitePage APIs

These methods have three signatures:

  • void NavigateTo(string URL)
  • void NavigateToSitePage(string page)
  • void NavigateToSitePage(string page, IPFFilterI filter)

When links are clicked that use these APIs, only the frame that the link was contained within navigates to the desired URL or page.

As shown, the NavigateToSitePage API can include a filter to give the destination page more information about what it should display. For example, if you are navigating to a product detail page, you can create a filter and pass in the product number so the page knows which product’s details to display. Filters can be created with the CreateFilter API.

Also, both APIs can include a navigation type object, such as FillWindow or NewWindow. This controls how the URL is to be navigated.

  • FillWindow: When the link is clicked, the entire browser window is filled with the new page.
  • NewWindow: When the link is clicked, the new page is loaded in a new browser tab.

These objects can be created using two public methods:

  • CreateNavigationTypeWindow(): Returns an IPFNavigationType object specifying the FillWindow Mode
  • CreateNavigationTypeNewWindow(): Returns an IPFNavigationType object specifying the NewWindow Mode

So the new signatures to be added to the Navigation APIs are these:

  • public void NavigateTo(string URL, IPFNavigationType type)
  • public void NavigateToSitePage(string page, IPFNavigationType type)
  • public void NavigateToSitePage(string page, IPFFilterI filter, IPFNavigationType type)

Sample code:

This sample code demonstrates the use of the navigation type parameter with the NavigateToSitePage API. When a FilterChanged event occurs for this grid, the architecture navigates to a new page. The code creates a IPFNavigationType object and passes it in to the NavigateToSitePage API. This ensures that once that code is executed, it navigates using the given filter, and it opens this page in a new window.


Public Sub OnFilterChanged(ByVal context As GridFilterChangedContextI, ByVal 
parms As GridFilterChangedParmsI)
  Dim newWindow As IPF.CustomCodeLib.IPFNavigationType =     
     context.CreateNavigationTypeNewWindow()
        context.NavigateToSitePage("NewSitePage", parms.Filter, newWindow)
    End Sub

NavigateToSitePageAsURL API

The NavigateToSitePageAsURL API is also provided for navigation options in the portals. This API can be used to set the NavigateToURLOnClick property, which embeds a link with the URL directly, rather than making a call back to the server to navigate to another page. This provides a performance advantage over the NavigateToSitePage API. Like NavigateToSitePage, NavigateToSitePageAsURL takes a page name and an optional filter and calculates the URL, but instead of navigating to it, this API returns the URL as a string.

This API has two signatures:

  • string NavigateToSitePageAsURL(string page)
  • string NavigateToSitePageAsURL(string page, IPFFilterI filter)

This API and property are very useful for navigating to a page name and filter that can be calculated before the page is displayed. If the page name and filter require information that is available only at the time the link is clicked, using the NavigateToSitePage API is recommended.

Sample code:

This sample code demonstrates the use of the NavigateToSitePageAsURL API.


Public Sub OnItemLoaded(ByVal context As MLLItemLoadedContextI, ByVal parms As 
MLLItemLoadedParmsI)
    Dim f As IPFFilterI
    f = context.CreateFilter()
    f.FilterItems.Add("TableName", "coitem")
    parms.Item.UnboundComponents("Button").NavigateToURLOnClick = 
context.NavigateToSitePageAsURL("Documents.aspx", f)
End Sub

The NavigateToURLOnClick property and the NavigateToSitePageAsURL API are being used in an OnItemLoaded event handler so that a button component, when clicked, does not have to return to the server to then execute the NavigateToSitePage API. Instead, the page can be navigated to as soon as the button is clicked.

About folder information

When the sitePageName provided does not have any folder information (it does not contain any '/' characters), then the implementation looks for an entry in the Pages content with a matching name in the same folder as the current page.

For example: context.NavigateToSitePage("OrderStatus.aspx")

When the sitePageName provided has folder information, then the implementation looks for an entry in the Pages content with a matching name and folder. For example:

contextNavigateToSitePage("/OrderStatus.aspx")

contextNavigateToSitePage("/IPFSitePages/OrderStatus.aspx")