The Snippet Control can be added to a Page Template in order to present a front-side editable chunk of data that is named in a property of the control.

The Control functions exactly like the property control except than instead of being databound to an arbitrary propertyon an entity, it displays the "adx_value" attribute of a named Content Snippet.

Adding a Snippet To a Page Template

When creating your Page Template, add the Snippet Control to whichever region of the page you wish for it to display in:

<!-- Will display the snippet with name "Footer Text Left" as en editable text field -->
<adx:Snippet SnippetName="Name" EditType="html" runat="server" />

The control's display is based on a number of controls, described below:

Properties

The Snippet Control Inherits from the property control, and thus has access to all of the same properties; though only the ones listed in the table are relevant. This is in addition to the SnippetName property, which determines the snippet that will provide data for the control. 

NameDescription
SnippetName The Name of the Content Snippet Entity in the CRM.
Format The custom format string through which the rendered value will be formatted.
Editable A boolean value that indicates whether or not this property value will be inline editable (provided the user has edit permission, and no other properties have been set on this control which disable inline editing support). Default is false.
EditType

String identifier of the type of editing interface to provide for this property. One of the following:

  • html
  • text
HtmlEncode A boolean value that indicates whether or not to perform an HtmlEncode on the output. Default is false. See HTMLEncode.
DefaultText The string to be rendered if the property value targeted by this control is null or empty.
Literal

A boolean value indicating whether or not this control should render as a literal value (only raw text with no surrounding DOM nodes)

Setting this value to true disables any inline editing support for the bound property.

Using the Expression Builder

Snippets can also be used similarily to Site Settings when you use the Snippet expression builder.  For all intents and purposes, Using a snippet in this way is the same as using a site setting.  Hwoever, it is useful as you can use a snippet that you are already rendering via a snippet control elsewhere in markup using the expression builder.

<!-- This will Eval "Name" against the current site map CRM entity -->
<adx:Property PropertyName="Name" DataItem='<%$ CrmSiteMap: Current %>' runat="server" />

The dollar sign ($) indicates to ASP.NET that an expression follows. The expression prefix "Snippet" defines the type of expression. Following the colon (:) is the actual expression value that ASP.NET will resolve to retrieve a Snippet by Name. Following the comma (,) is an optional default value. Expression syntax is not bound to any specific .NET language. You can use the same expression syntax whether you use Visual Basic, C#, or any other programming language in your ASP.NET page

An Expression Builder must be declared in the portal's web.config file.
  Related Topics