New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Represents a template that can contain both string content and Telerik UI components.

Definition

Namespace:Kendo.Mvc.UI

Assembly:Kendo.Mvc.dll

Type Parameters:

TModel

The type of the model that the template is bound to.

Syntax:

C#
public class Template<TModel>

Inheritance: objectTemplate<TModel>

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the Template<TModel> class.

C#
public Template(WidgetFactory<TModel> widgetFactory)
Parameters:widgetFactoryWidgetFactory<TModel>

The widget factory that creates widgets within this template.

Fields

A placeholder used to inject additional content during serialization.

C#
public const string AdditionalContentPlaceholder = "/*kendoTmpPlaceholder*/"

Properties

Gets the collection of template items.

C#
public ICollection<object> Items { get; }

Gets the widget factory associated with this template.

C#
public WidgetFactory<TModel> WidgetFactory { get; }

Methods

Serializes the template as a JavaScript function.

C#
public string Serialize()
Returns:

string

A JavaScript function string that renders the template content.

This method generates a JavaScript function that renders the template items. The function accepts a data parameter and returns the generated content as a string.

Serializes the template as a JavaScript function suitable for form editors.

C#
public string SerializeFormEditor()
Returns:

string

A JavaScript function string that renders the template content for form editing.

This method generates a JavaScript function that renders the template items as form elements. The function accepts container and options parameters, and appends the generated content to the container.