You are here: Ektron Namespace > .NET Assemblies > Ektron.Cms.API Namespace > Classes > SiteMap Class > SiteMap Methods > GetFolderBreadcrumbPath
Ektron CMS400.NET API Documentation
ContentsIndexHome
PreviousUpNext
SiteMap.GetFolderBreadcrumbPath Method

Get breadcrumb path of the folder in which content block exists.

C#
public Ektron.Cms.Common.SitemapPath[] GetFolderBreadcrumbPath(Long id, Optional ByVal Boolean isFolder);
Visual Basic
Public Function GetFolderBreadcrumbPath(ByVal id As Long, Optional ByVal isFolder As Boolean = False) As Ektron.Cms.Common.SitemapPath()
Parameters 
Description 
id 
Content or Folder ID. 
isFolder 
Set to True if the ID is a folder ID. 

Array of nodes in the path.

The following example shows how to create a Web page from which the breadcrumb path for a given folder can be retrieved. In this This example uses some standard drag and drop controls and a small section of VB code utilizing the GetFolderBreadcrumbPath method. The GetFolderBreadcrumbPath method allows you to use a folder ID or a content's ID to retrieve the information. This method uses the InternalAdmin to retrieve the breadcrumb path. In the first section, we will deal with the standard drag and drop controls. In the second, we'll deal with the code behind. 

 

  1. Between the form tags, add a radio button list. We will populate the radio buttons in the code behind.
       <asp:RadioButtonList ID="rblItem" runat="server" Height="64px"></asp:RadioButtonList>
  2. Add two breaks for spacing purposes.
       <br /><br />
  3. Add a label to show where the ID goes.
       <asp:Label ID="Label6" runat="server" Text="ID:" Width="76px"></asp:Label>
  4. Add a text box for the ID.
       <asp:TextBox ID="txtId" runat="server" Width="55px"></asp:TextBox>
  5. From the Validation control menu, add a RequiredFieldValidator control. This validates that something appears in the ID box.
       <asp:RequiredFieldValidator ID="rfvId" runat="server" ControlToValidate="txtId"
             ErrorMessage="Please enter a content/folder ID" Width="179px"></asp:RequiredFieldValidator>
  6. Add two more breaks for spacing purposes.
       <br /><br />
  7. Add a button to submit the ID to be queried. We will set the button click event in the code behind.
       <asp:Button ID="btnGet" runat="server" Text="Get Breadcrumb" Width="105px" />
  8. Add two last breaks for spacing purposes.
       <br /><br />
  9. Add a label to display the breadcrumb path.
       <asp:Label ID="lblResult" runat="server" Width="502px" Height="100px"></asp:Label>

 

Add the following information to the code behind of your aspx.vb page.

  1. In the page load event, populate the radio buttons.

       Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
         If Not IsPostBack() Then 
             rblItem.Items.Add(New ListItem("Folder", "true"))
             rblItem.Items.Add(New ListItem("Content", "false"))
             rblItem.Items(0).Selected = True
         End If
       End Sub

  1. Add a button click event.

       Protected Sub btnGet_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGet.Click

  1. Check to make sure the ID is numeric.

           If Not IsNumeric(txtId.Text) Then
               lblResult.Text = "Invalid content/folder ID"
               Exit Sub
           End If

  1. Create an object for the Site Map API.

           Dim sitemapApi As New Ektron.Cms.API.SiteMap

  1. Create an object for the site map data.

           Dim mapData As Ektron.Cms.Common.SitemapPath()

  1. Create a Try/Catch around the GetFolderBreadcrumbPath method. This allows you to catch any exceptions and helps when debugging.

           Try
               mapData = sitemapApi.GetFolderBreadcrumbPath(CInt(txtId.Text), CBool(rblItem.SelectedValue))

  1. Check to make sure map data is returned. If map data is returned, display the information.

               If (Not mapData Is Nothing) AndAlso (mapData.Length > 0) Then
                   lblResult.Text = sitemapApi.RenderFolderBreadcrumbHtml(mapData, ">", True, "", False, "")

  1. If no map data exists, display a message.

               Else
                   lblResult.Text = "No breadcrumb path found"
               End If

  1. Display a message if there is an error.

              Catch ex As Exception
                 lblResult.Text = ex.Message
              End Try
       End Sub
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at [email protected].
Copyright (c) 2008. All rights reserved.
What do you think about this topic? Send feedback!