Set virtual nodes in the Breadcrumb widget

The IBreadcrumExtender interface allows you to add additional nodes at the end of the current sitemap path through the widgets on the page. The scenario that it is implemented for is to display the Title of the content item that is loaded in DetailsMode in the ContentView widget, as a part of the breadcrumb. You can use it in any custom control, in order to add additional nodes to the current sitemap path. When used in custom widgets, the widget must register an object of type IBreadcrumbExtender in the current page using RegisterBreadcrumbExtender extension method declared in the Telerik.Sitefinity.Web namespace.

NOTE: To see the virtual nodes in the breadcrumb widget, you must set its AllowVirtualNodes property to true. For more information about the Breadcrumb widget, read Breadcrumb widget.

To extend your custom control with this functionality, you must perform the following:

  1. Implement the IBreadcrumExtender interface.
    The interface can be found in the Telerik.Sitefinity.Web namespace.
  2. Implement the GetVirtualNodes method.
    The GetVirtualNodes method returns the virtual nodes that you want to append to the sitemap path. To create them, you must perform the following:
    1. Create an empty list.
      Create a List of SiteMapNode objects.
    2. Create a sitemap node.
      Create an instance of the SiteMapNode class.
    3. Add the node to the list.
      Add the instance of the SiteMapNode to the list that was created in step 1.
    4. Return the list.
      Return the list of sitemap nodes.
  3. Override the OnPreRender method of your widget.
    In the override, call the RegisterBreadcrumbExtender method of the System.Web.UI.Page instance and pass the instance of your widget as an argument.

Use the following code sample of IBreadcrumExtender implementation:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?