Return to

Presentation Component API Cookbook

This Cookbook provides information about APIs that Sitecore developers can use in presentation components including layouts, sublayouts, Web controls, and pipeline processors.

Click the respective link  to download the PDF version of the whole document.

Sitecore CMS 6.4 version:

Sitecore CMS 6.2 or 6.3 version:

Sitecore CMS 6.1 or 6.0 version:

Related reading:

Table of Contents (valid for Sitecore CMS 6.2)

The Sitecore Context 
    Overview of the Sitecore Context  
    The Context Item  
    The Context Site 
        The Home Item of the Context Site  
    The Context Database  
    The Context Language  
    The Context Device
        Example: Set the Context Device 
    The Context Domain  
    The Context User  
    The Context Raw URL  
    The Context Page Mode 
        Example: Expose Metadata Fields  
Accessing Items  
    Overview of Accessing Items  
        How to Access the Friendly URL of a Content Item  
        How to Access the Friendly URL of a Media Item
        How to Determine if an Item Contains Layout Details for a Device
    How to Populate ASP.NET Controls with Item Values  
        How to Bind the Children of an Item to an ASP.NET Control  
            How to Bind a List of Items to a Control  
        How to Use Field Values when Binding Items to a Control
        How to Populate an ASP.NET Repeater with Item Data
    How to Access the Descendants of an Item
        Example: Site Map Web Control
    How to Access the Ancestors of an Item
        Example: Breadcrumb Web Control
        Example: Styled Navigation Web Control
    Sorting Items
        Child Sorting Rules
        How to Select a Child Sorting Rule
        How to Implement a Custom Item Comparer 
            Example: Sort Items by a Field Value
        How to Implement a Custom Child Sorting Rule
        How to Sort a List of Items
        Example: Latest Items Web Control 
Accessing Fields  
    Overview of Accessing Fields  
        How to Transform Dynamic Links in RTE Fields to Friendly URLs  
    The renderField Pipeline  
    The FieldRenderer Web Control  
    The Field Type Web Controls  
        The Link Field Web Control
        The Image Field Web Control  
        The Date Field Web Control
        The Text Field Web Control
    Examples of Accessing Fields
        Example: Link to Item in a Selection Field
        Example: Link to Media in a File or Image Field
        Example: Link to Items in a Multiselect Field 
        Example: Link to Media Items in File Drop Area Field

Working with Languages 
    Overview of Languages
    Examples Involving Languages
        Example: Link to Items with Version Data for the Context Language
        Example: Language Flags Web Control
        Example: Determine Context Language from the User Profile
        The Language Processor Base Class
        Example: Determine Language from Web Client Preferences
        Example: Set Thread Culture
        Supporting Fallback Languages
        Example: Field Fallback Languages
        Example: Item Fallback Languages
Error Management
    Exception Management Overview
        ASP.NET Exception Management
    Try/Catch Blocks
    Sitecore Error Pages
    How to Trap XSL Rendering Exceptions
        The Error Helper
    How to Trap Web Control Rendering Exceptions
    How to Trap Layout Exceptions
    How to Trap Application Exceptions