ListViewBuilder

Properties

WriteAction - Func

Methods

DataSource(System.Action)

Binds the ListView to a DataSource.

Parameters

configurator - System.Action<DataSourceBuilder>

The DataSourceBuilder configurator.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
                 @(Html.Kendo().ListView<ProductViewModel>()
                     .Name("productsLitView")
                     .DataSource(dataSource => dataSource
                         .Ajax()
                         .Read(read => read.Action("Products_Read", "ListView"))
                         .PageSize(21)
                     )
                 )
             

BindTo(System.Collections.Generic.IEnumerable)

Binds the ListView to a list of objects

Parameters

dataSource - System.Collections.Generic.IEnumerable<T>

The IEnumerable list of objects.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
                @(Html.Kendo().ListView<ProductViewModel>()
                    .Name("productsLitView")
                    .BindTo((IEnumerable<ProductViewModel>) ViewData["Products"])
                )
             

DataSource(System.String)

Binds the ListView to an existing DataSource instance.

Parameters

dataSourceId - System.String

The name of the client DataSource instance.

Example

Razor
 
                @(Html.Kendo().DataSource<ProductViewModel>()
                    .Name("dataSource1")
                    .Ajax(dataSource => dataSource
                       .PageSize(10)
                       .Read(read => read.Action("Products_Read", "DataSource"))
                    )
                )
                @(Html.Kendo().ListView<ProductViewModel>()
                    .Name("productsLitView")
                    .DataSource("dataSource1")
                )
             

BindTo(System.Collections.IEnumerable)

Binds the ListView to a list of objects

Parameters

dataSource - System.Collections.IEnumerable

The data source.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView<ProductViewModel>()
                .Name("productsLitView")
                .BindTo((IEnumerable<ProductViewModel>) ViewData["Products"])
            )
             

ClientTemplateId(System.String)

Specifies ListView item template.

Parameters

templateId - System.String

The Id of the script element which contains the template.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView<ProductViewModel>()
                        .Name("productsListView")
                        .ClientTemplateId("listViewTemplate")
            )
             

ClientTemplateView(Microsoft.AspNetCore.Html.IHtmlContent)

Specifies ListView item template.

Parameters

templateView - Microsoft.AspNetCore.Html.IHtmlContent

The view which contains the template.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView<ProductViewModel>()
                        .Name("productsListView")
                        .ClientTemplateView(Html.Partial("listViewTemplate"))
            )
             

ClientTemplateHandler(System.String)

Specifies ListView item template.

Parameters

templateHandler - System.String

The function handler which contains the template.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView<ProductViewModel>()
                        .Name("productsListView")
                        .ClientTemplateHandler("listViewHandler")
            )
             

ClientTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

Specifies ListView item template.

Parameters

template - TemplateBuilder<TModel>

The template component which contains the template.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView<ProductViewModel>()
                        .Name("productsListView")
                        .ClientTemplate(Html.Kendo()
                                .Template()
                                .AddHtml("<p>${data.ProductName}</p>")
                        )
            )
             

ClientAltTemplateId(System.String)

Specifies ListView alternating item template.

Parameters

templateId - System.String

The Id of the script element which contains the template.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
             @(Html.Kendo().ListView<ProductViewModel>()
                        .Name("productsListView")
                        .ClientAltTemplateId("listViewTemplate")
             )
             

ClientAltTemplateView(Microsoft.AspNetCore.Html.IHtmlContent)

Specifies ListView alternating item template.

Parameters

templateView - Microsoft.AspNetCore.Html.IHtmlContent

The view which contains the template.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
             @(Html.Kendo().ListView<ProductViewModel>()
                        .Name("productsListView")
                        .ClientAltTemplateView(Html.Partial("listViewTemplate"))
             )
             

ClientAltTemplateHandler(System.String)

Specifies ListView alternating item template.

Parameters

templateHandler - System.String

The view which contains the template.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
             @(Html.Kendo().ListView<ProductViewModel>()
                        .Name("productsListView")
                        .ClientAltTemplateHandler("listViewHandler")
             )
             

ClientAltTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

Specifies ListView alternating item template.

Parameters

template - TemplateBuilder<TModel>

The template component which contains the template.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
             @(Html.Kendo().ListView<ProductViewModel>()
                        .Name("productsListView")
                        .ClientAltTemplate(Html.Kendo()
                                .Template()
                                .AddHtml("<p>${data.ProductName}</p>")
                        )
             )
             

Pageable()

Allows paging of the data.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView<ProductViewModel>()
                    .Name("productsLitView")
                    .Pageable()
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .Read(read => read.Action("Products_Read", "ListView"))
                        .PageSize(21)
                    )
            )
             

Pageable(System.Action)

Allows paging of the data.

Parameters

pagerAction - System.Action<ListViewPageableBuilder>

Use builder to define paging settings.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView<ProductViewModel>()
                    .Name("productsLitView")
                    .Pageable(paging => paging.Numeric(true).PreviousNext(true).PageSizes(false))
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .Read(read => read.Action("Products_Read", "ListView"))
                        .PageSize(21)
                    )
            )
             

Scrollable()

If set, the ListView will display a scrollbar when the content exceeds the ListView's height. By default, scrolling is disabled.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
             @(Html.Kendo().ListView<ProductViewModel>()
                    .Name("productsLitView")
                    .Scrollable()
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .Read(read => read.Action("Products_Read", "ListView"))
                        .PageSize(21)
                    )
            )
             

Scrollable(Kendo.Mvc.UI.ListViewScrollableMode)

In endless scrolling mode the listview should be configured to display a scrollbar. Scrolling to the end of the scrollbar will load more items (equal to the pageSize number) and append them to the listview DOM element utill all items are loaded and displayed.

Parameters

mode - ListViewScrollableMode

The value for Scrollable

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
             @(Html.Kendo().ListView<ProductViewModel>()
                    .Name("productsLitView")
                    .Scrollable(ListViewScrollableMode.Endless)
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .Read(read => read.Action("Products_Read", "ListView"))
                        .PageSize(21)
                    )
            )
             

Selectable(Kendo.Mvc.UI.ListViewSelectionMode)

Enables selection in the specified selection mode.

Parameters

mode - ListViewSelectionMode

The selection mode.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
             @(Html.Kendo().ListView<ProductViewModel>()
                    .Name("productsLitView")
                    .Selectable(select=>select.Mode(ListViewSelectionMode.Multiple))
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .Read(read => read.Action("Products_Read", "ListView"))
                        .PageSize(21)
                    )
            )
             

Selectable()

Enables selection in the specified selection mode.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
             @(Html.Kendo().ListView<ProductViewModel>()
                    .Name("productsLitView")
                    .Selectable(select=>select.Mode(ListViewSelectionMode.Multiple))
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .Read(read => read.Action("Products_Read", "ListView"))
                        .PageSize(21)
                    )
            )
             

Editable(System.Action)

Configures the ListView editing settings.

Parameters

configurator - System.Action<ListViewEditingSettingsBuilder>

The editing settings configurator.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView<ProductViewModel>()
                   .Name("productsLitView")
                   .Editable(edit => edit.Enabled(true))
                   .DataSource(dataSource => dataSource
                       .Ajax()
                       .Model(model => model.Id("ProductID"))
                       .Read(read => read.Action("Products_Read", "ListView"))
                       .Update(update => update.Action("Products_Update", "ListView"))
                       .PageSize(21)
                   )
            )
             

Editable()

Configures the ListView editing settings.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView<ProductViewModel>()
                   .Name("productsLitView")
                   .Editable(edit => edit.Enabled(true))
                   .DataSource(dataSource => dataSource
                       .Ajax()
                       .Model(model => model.Id("ProductID"))
                       .Read(read => read.Action("Products_Read", "ListView"))
                       .Update(update => update.Action("Products_Update", "ListView"))
                       .PageSize(21)
                   )
            )
             

AriaLabel(System.String)

Sets an aria-label attribute on the ListView content element (the element with role listbox or list).

Parameters

value - System.String

The value for AriaLabel

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView<ProductViewModel>()
                  .Name("productsListView")
                  .AriaLabel("ListView with products")
            )
             

AutoBind(System.Boolean)

If set to false the widget will not bind to the data source during initialization. In this case data binding will occur when the change event of the data source is fired. By default the widget will bind to the data source specified in the configuration.

Parameters

value - System.Boolean

The value for AutoBind

RETURNS

Returns the current ListViewBuilder instance.

Bordered(System.Boolean)

Renders border around the listview element.

Parameters

value - System.Boolean

The value for Bordered

RETURNS

Returns the current ListViewBuilder instance.

Borders(System.String)

Renders border around the listview items. Valid values are: all: renders borders around listview items.; horizontal: renders top border of listview items. Useful when setting layout: "flex" and flex.direction: column. or vertical: renders top border of listview items. Useful when setting layout: "flex" and flex.direction: row..

Parameters

value - System.String

The value for Borders

RETURNS

Returns the current ListViewBuilder instance.

ContentElement(System.String)

Defines the type of element that holds the listview content.

Parameters

value - System.String

The value for ContentElement

RETURNS

Returns the current ListViewBuilder instance.

Layout(System.String)

Specify the layout of listview content. Valid options are: flex: This is equivalent to display: flex. It defines a flex container and enables a flex context for all its direct children. Think of flex items as primarily laying out either in horizontal rows or vertical columns. or grid: This is equivalent to display: grid. It defines the element as a grid container and establishes a new grid formatting context for its contents..

Parameters

value - System.String

The value for Layout

RETURNS

Returns the current ListViewBuilder instance.

Flex(System.Action)

Flex layout settings

Parameters

configurator - System.Action<ListViewFlexSettingsBuilder>

The configurator for the flex setting.

RETURNS

Returns the current instance of ListViewBuilder .

Grid(System.Action)

Grid layout settings.

Parameters

configurator - System.Action<ListViewGridSettingsBuilder>

The configurator for the grid setting.

RETURNS

Returns the current instance of ListViewBuilder .

Indicates whether keyboard navigation is enabled/disabled.

Parameters

value - System.Boolean

The value for Navigatable

RETURNS

Returns the current ListViewBuilder instance.

Indicates whether keyboard navigation is enabled/disabled.

RETURNS

Returns the current ListViewBuilder instance.

TagName(System.String)

Specifies ListView wrapper element tag name.

Parameters

value - System.String

The value for TagName

RETURNS

Returns the current ListViewBuilder instance.

Selectable(System.Action)

Specifies whether item selection is allowed. By default selection is disabled

Parameters

configurator - System.Action<ListViewSelectableSettingsBuilder>

The configurator for the selectable setting.

RETURNS

Returns the current instance of ListViewBuilder .

Selectable(System.Boolean)

Specifies whether item selection is allowed. By default selection is disabled

Parameters

enabled - System.Boolean

Enables or disables the selectable option.

RETURNS

Returns the current instance of ListViewSelectableSettingsBuilder .

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<ListViewEventBuilder>

The client events action.

RETURNS

Returns the current ListViewBuilder instance.

Example

Razor
 
            @(Html.Kendo().ListView()
                  .Name("ListView")
                  .Events(events => events
                      .Cancel("onCancel")
                  )
            )
             

ToComponent()

Returns the internal view component.

RETURNS

The instance that represents the component.

Expression(System.String)

Sets the name of the component.

Parameters

modelExpression - System.String

RETURNS

Returns the current instance.

Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)

Sets the name of the component.

Parameters

modelExplorer - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer

RETURNS

Returns the current instance.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name.

RETURNS

Returns the current instance.

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with

Parameters

deferred - System.Boolean

RETURNS

Returns a DeferredWidgetBuilder instance.

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

RETURNS

Returns the current instance.

HtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The HTML attributes.

RETURNS

Returns the current instance.

ScriptAttributes(System.Object,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Object

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

RETURNS

Returns the current instance.

ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

RETURNS

Returns the current instance.

Render()

Renders the component in place.

ToHtmlString()

Returns the HTML representation of the component.

WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)

Parameters

writer - System.IO.TextWriter
encoder - System.Text.Encodings.Web.HtmlEncoder

ToClientTemplate()

Returns the client template for the component.

AsModule(System.Boolean)

Specifies whether the initialization script of the component will be rendered as a JavaScript module.

Parameters

value - System.Boolean

RETURNS

Returns the current instance.

In this article
PropertiesWriteAction - FuncMethodsDataSource(System.Action)BindTo(System.Collections.Generic.IEnumerable)DataSource(System.String)BindTo(System.Collections.IEnumerable)ClientTemplateId(System.String)ClientTemplateView(Microsoft.AspNetCore.Html.IHtmlContent)ClientTemplateHandler(System.String)ClientTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)ClientAltTemplateId(System.String)ClientAltTemplateView(Microsoft.AspNetCore.Html.IHtmlContent)ClientAltTemplateHandler(System.String)ClientAltTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)Pageable()Pageable(System.Action)Scrollable()Scrollable(Kendo.Mvc.UI.ListViewScrollableMode)Selectable(Kendo.Mvc.UI.ListViewSelectionMode)Selectable()Editable(System.Action)Editable()AriaLabel(System.String)AutoBind(System.Boolean)Bordered(System.Boolean)Borders(System.String)ContentElement(System.String)Layout(System.String)Flex(System.Action)Grid(System.Action)Navigatable(System.Boolean)Navigatable()TagName(System.String)Selectable(System.Action)Selectable(System.Boolean)Events(System.Action)ToComponent()Expression(System.String)Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)Name(System.String)Deferred(System.Boolean)HtmlAttributes(System.Object)HtmlAttributes(System.Collections.Generic.IDictionary)ScriptAttributes(System.Object,System.Boolean)ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)Render()ToHtmlString()WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)ToClientTemplate()AsModule(System.Boolean)
Not finding the help you need?
Contact Support