Kentico Xperience 13 documentation and ASP.NET Core

Most documentation about running Xperience applications under ASP.NET Core can be found in a dedicated section: Developing Xperience applications using ASP.NET Core. The rest of the documentation still applies, but some code samples and scenarios might need slight modifications for Core projects.

All major differences between the MVC 5 and Core platforms are summarized in Migrating to ASP.NET Core.

×

Reference - Xperience Tag Helpers

This page provides a reference of all ASP.NET Core Tag Helpers provided by the Xperience API.

Adding Tag Helpers to views

You can add individual Tag Helpers to your views via the @addTagHelper directive. Specify the fully qualified name of the Tag Helper class and the name of the assembly where it is located (both provided in the corresponding sections below). Alternatively, you can use the '*' wildcard to include all Tag Helpers matching a specified pattern.

@* Adds all Tag Helpers from the Kentico.Content.Web.Mvc assembly to the view *@
@addTagHelper *, Kentico.Content.Web.Mvc

@* Adds the form zone Tag Helper to the view *@
@addTagHelper Kentico.Content.Web.Mvc.FormZoneTagHelper, Kentico.Content.Web.Mvc

Add the Tag Helpers in relevant _ViewImports.cshtml files to make them available in all related views automatically. 

On this page

Tag Helpers – Page builder

Page builder scripts

Fully qualified name: Kentico.Content.Web.Mvc.PageBuilderScriptsTagHelper

Assembly name: Kentico.Content.Web.Mvc

Renders markup that includes scripts required by the page builder feature. Serves as an alternative to the HtmlHelper.Kentico().PageBuilderScripts extension method.

The Tag Helper includes scripts used in the system's editing interface, as well as those of individual page builder components (widgets, sections, inline property editors, page templates). See the linked documentation to learn how to correctly add custom scripts for your own components.

@addTagHelper Kentico.Content.Web.Mvc.PageBuilderScriptsTagHelper, Kentico.Content.Web.Mvc
 
<page-builder-scripts />

Page builder styles

Fully qualified name: Kentico.Content.Web.Mvc.PageBuilderStylesTagHelper

Assembly name: Kentico.Content.Web.Mvc

Renders markup that includes style sheets required by the page builder feature. Serves as an alternative to the HtmlHelper.Kentico().PageBuilderStyles extension method.

The Tag Helper includes style sheets used in the system's editing interface, as well as those of individual page builder components (widgets, sections, inline property editors, page templates). See the linked documentation to learn how to correctly add custom style sheets for your own components.

@addTagHelper Kentico.Content.Web.Mvc.PageBuilderStylesTagHelper, Kentico.Content.Web.Mvc
 
<page-builder-styles />

Editable area

Fully qualified name: Kentico.Content.Web.Mvc.EditableAreaTagHelper

Assembly name: Kentico.Content.Web.Mvc

Marks a location where a page builder editable area is to be rendered when editing the page via the administration interface. Serves as an alternative to the HtmlHelper.Kentico().EditableAreaAsync extension method.

The helper has the following required attributes:

  • area-identifier – identifier of the area unique within the context of the given page.

@addTagHelper Kentico.Content.Web.Mvc.EditableAreaTagHelper, Kentico.Content.Web.Mvc
 
<editable-area area-identifier="areaSimple" />
Optionally, you can pass an EditableAreaOptions object via the area-options attribute to further configure the area. See Creating pages with editable areas for details.
@addTagHelper Kentico.Content.Web.Mvc.EditableAreaTagHelper, Kentico.Content.Web.Mvc
@using Kentico.PageBuilder.Web.Mvc
 
@{
    var options = new EditableAreaOptions
    {
        AllowedWidgets = new[] { "LearningKit.Widgets.NumberWidget",
                                 "LearningKit.Widgets.SomeOtherWidget" },
        AllowedSections = AllowedComponents.ALL
    };
}
 
<editable-area area-identifier="areaConfigured" area-options="options" />
Alternatively, you can pass each property of the EditableAreaOptions object as an individual attribute:

  • area-options-allowed-sections – a list of section identifiers that can be added to the area. If left empty, all sections are allowed.
  • area-options-allowed-widgets – a list of widget identifiers that can be added to the area. If left empty, all widget are allowed.
  • area-options-default-section-identifier – identifier of the default section for the area.

Note that if you both pass the options object and specify some parameters directly via attributes, the parameters specified via attributes take precedence (i.e., override the corresponding properties of the options object).

Widget zone

Fully qualified name: Kentico.Content.Web.Mvc.WidgetZoneTagHelper

Assembly name: Kentico.Content.Web.Mvc

Marks a location where widgets can be placed within a page builder section. Serves as an alternative to the HtmlHelper.Kentico().WidgetZoneAsync extension method.

Every section must contain at least one widget zone – sections without widget zones are not supported.

@addTagHelper Kentico.Content.Web.Mvc.WidgetZoneTagHelper, Kentico.Content.Web.Mvc
 
<widget-zone />

Page data

Fully qualified name: Kentico.Content.Web.Mvc.WidgetZoneTagHelper

Assembly name: Kentico.Content.Web.Mvc

Renders an invisible form field that includes contextual information about the page. Necessary when developing components that use POST actions. Serves as an alternative to the HtmlHelper.Kentico().PageData extension metod.

@addTagHelper Kentico.Content.Web.Mvc.PageDataTagHelper, Kentico.Content.Web.Mvc
 
<form asp-controller="Controller" asp-action="HandlePost" id="form">
 
    ...
 
    <page-data />
 
    <input type="submit" value="Submit" />
</form>

Component properties data

Fully qualified name: Kentico.Content.Web.Mvc.ComponentPropertiesDataTagHelper

Assembly name: Kentico.Content.Web.Mvc

Used to persist properties of the currently rendered component for POST actions. Server as an alternative to the HtmlHelper.Kentico().ComponentPropertiesData extension method. 

@addTagHelper Kentico.Content.Web.Mvc.ComponentPropertiesDataTagHelper, Kentico.Content.Web.Mvc
 
<form asp-controller="Controller" asp-action="HandlePost" id="form">
 
    ...
 
    <component-properties-data />
 
    <input type="submit" value="Submit" />
</form>

Stand-alone widget

Fully qualified name: Kentico.Content.Web.Mvc.StandaloneWidgetTagHelper

Assembly name: Kentico.Content.Web.Mvc

Renders a specified widget directly. Serves as an alternative to the HtmlHelper.Kentico().RenderStandaloneWidgetAsync extension method. See Rendering widgets directly.

The helper has the following attributes:

  • widget-type-identifier – the string identifier under which the widget was registered.
  • (Optional) widget-properties – IWidgetProperties object representing the widget's properties. Create an instance of the appropriate property model class and set any required values.

@addTagHelper Kentico.Content.Web.Mvc.StandaloneWidgetTagHelper, Kentico.Content.Web.Mvc
@using Kentico.Forms.Web.Mvc.Widgets
@using Kentico.Content.Web.Mvc
 
@{
    var widgetProperties = new FormWidgetProperties()
    {
        SelectedForm = "FormCodeName"
    };
}
 
@* Renders the system's default Form widget *@
<standalone-widget widget-type-identifier="@SystemComponentIdentifiers.FORM_WIDGET_IDENTIFIER" widget-properties="widgetProperties" />

Nested widget

Fully qualified name: Kentico.Content.Web.Mvc.NestedWidgetTagHelper

Assembly name: Kentico.Content.Web.Mvc

Renders a widget nested inside another widget. Serves as an alternative to the HtmlHelper.Kentico().RenderNestedWidgetAsync extension method. See Extending widgets

@addTagHelper Kentico.Content.Web.Mvc.NestedWidgetTagHelper, Kentico.Content.Web.Mvc
 
@* In this example, the extended widget uses an extended FormWidgetProperties class *@
@model ComponentViewModel<ExtendedFormWidgetProperties>
 
@* Renders the system's default Form widget as the nested widget *@
<nested-widget widget-type-identifier="@SystemComponentIdentifiers.FORM_WIDGET_IDENTIFIER" widget-properties="Model.Properties" />

Tag Helpers – Form builder

Form zone

Fully qualified name: Kentico.Content.Web.Mvc.FormZoneTagHelper

Assembly name: Kentico.Content.Web.Mvc

Marks a location where form components can be placed within a form section. Serves as an alternative to the HtmlHelper.Kentico().FormZoneAsync extension method.

@addTagHelper Kentico.Content.Web.Mvc.FormZoneTagHelper, Kentico.Content.Web.Mvc
 
<form-zone />


Was this page helpful?