Sublayouts

Sublayouts

Sublayouts

  • The combination of a definition item and .ascx file that defines the layout for a portion of a page
  • Defines the appearance of an area of a page using markup and C Sharp code
  • The definition item indicates the name and location of the associated .ascx file
  • Can be added to a layout or another sublayout, either with or without a Sitecore Placeholder
  • Does not contain a head section, body section, or a form element
  • Also referred to as ASP.NET web user controls or just user controls

CodeBehind or CodeFile

  • Sublayouts also contain a file with a .ascx.cs extension for code
  • Use Codebehind in the Control declaration for web applications
  • Use CodeFile in the Control declaration for web sites or so that you do not need to build after each code change
  • Do not use a code behind file if the sublayout is only used to structure renderings provided by other presentation components

Sublayout Definition Items

  • Grid Designer tab displays static references on layout
  • Content tab shows item definition, including the path to the associated .ascx  file

Sitecore Sublayout Guidelines

  • Group components that are always used together in sublayouts
  • Add at least one Sitecore placeholder so the sublayout can be reused

Sources