Skip to main content

WidgetFactory<TModel>.NamedTemplate(String) Method

Creates a named template.

Namespace: DevExtreme.AspNet.Mvc.Factories

Assembly: DevExtreme.AspNet.Core.dll

Declaration

public IDisposable NamedTemplate(
    string name
)

Parameters

Name Type Description
name String

A template name.

Returns

Type Description
IDisposable

An IDisposable object that ends the template when disposed.

Remarks

Refer to External Templates for more information.

The following example demonstrates how to create a named template and apply it to a list item:

@(Html.DevExtreme().List()
    .ItemTemplate(new TemplateName("myList_itemTemplate"))
)

@using(Html.DevExtreme().NamedTemplate("myList_itemTemplate")) {
    <div>
        Template content
    </div>
}
See Also