GridTagHelper
Kendo UI Grid TagHelper GridTagHelper class.
Definition
Namespace:Kendo.Mvc.TagHelpers
Assembly:Kendo.Mvc.dll
Syntax:
[HtmlTargetElement("kendo-grid")]
[RestrictChildren("allow-copy", new string[] { "column-menu", "editable", "excel", "filterable", "groupable", "messages", "no-records", "pageable", "pdf", "scrollable", "sortable", "columns", "datasource", "toolbar", "search", "selectable", "reorderable", "resizable", "grid-row-template", "grid-alt-row-template", "grid-detail-template", "grid-toolbar-template", "grid-pinned-row-template", "context-menu", "stacked-layout-settings", "ai", "grid-status-bar-template", "smart-box", "pinnable" })]
public class GridTagHelper : TagHelperBase, ITagHelper, ITagHelperComponent, IDataBoundWidget<DataSourceTagHelper>, ITemplateComponent
Inheritance: objectTagHelperTagHelperBaseGridTagHelper
Implements:
Inherited Members
Example:
@addTagHelper *, Kendo.Mvc
<kendo-grid name="grid">
<columns>
<column field="ContactName" width="140"></column>
<column field="ContactTitle" width="190"></column>
<column field="CompanyName"></column>
<column field="Country" width="110"></column>
</columns>
<datasource type="DataSourceTagHelperType.Ajax">
<transport>
<read url="@Url.Action("Customers_Read","Grid")"/>
</transport>
</datasource>
</kendo-grid>
Child Tags
Constructors
Initializes a new instance of the GridTagHelper class.
Properties
Specifies the adaptive rendering of the component.
public AdaptiveMode? AdaptiveMode { get; set; }
If set to true and the selection functionality of the Grid is enabled, the user can paste the current textual content of the clipboard into the Grid.
public bool? AllowPaste { get; set; }
The id of the template used for rendering the alternate rows in the grid.
public string AltRowTemplate { get; set; }
The id of the template used for rendering the alternate rows in the grid. This option expects the name of a JavaScript function that will be called to return the template.
public string AltRowTemplateHandler { get; set; }
The id of the template used for rendering the alternate rows in the grid. This option expects the ID of the script element that contains the template.
public string AltRowTemplateId { get; set; }
The id of the template used for rendering the alternate rows in the grid. This option expects the IHtmlContent instance containing the created HTML.
public IHtmlContent AltRowTemplateView { get; set; }
If set to false, the Grid will not bind to the data source during initialization, i.e. it will not call the fetch method of the dataSource instance. In such scenarios data binding will occur when the change event of the dataSource instance is fired. By default, autoBind is set to true and the widget will bind to the data source specified in the configuration.
public bool? AutoBind { get; set; }
Defines the width of the column resize handle in pixels. Apply a larger value for easier grasping.
public double? ColumnResizeHandleWidth { get; set; }
If set to true, the context menu for the Grid will be enabled. Use the context-menu TagHelper to customize the context menu.
public bool? ContextMenu { get; set; }
Defines the data layout mode of the grid.
[HtmlAttributeName("layout-mode")]
public DataLayoutMode? DataLayoutMode { get; set; }
Sets the ID of the DataSource widget used by the Grid.
public string DatasourceId { get; set; }
The id of the template used for rendering the detail rows in the grid.
public string DetailTemplate { get; set; }
The id of the template used for rendering the detail rows in the grid. This option expects the name of a JavaScript function that will be called to return the template.
public string DetailTemplateHandler { get; set; }
The id of the template used for rendering the detail rows in the grid. This option expects the ID of the script element that contains the template.
public string DetailTemplateId { get; set; }
The id of the template used for rendering the detail rows in the grid. This option expects the IHtmlContent instance containing the created HTML.
public IHtmlContent DetailTemplateView { get; set; }
If set to true the user would be able to edit the data to which the grid is bound. By default editing is disabled.Can be set to a string ("inline", "incell" or "popup") to specify the editing mode. The default editing mode is "incell".Can be set to a JavaScript object which represents the editing configuration.
[HtmlAttributeName("editable")]
public string EditableValue { get; set; }
If set to true the column title will be HTML-encoded before it is displayed. If set to false the column title will be displayed as is.
public bool? EncodeTitles { get; set; }
The height of the grid. Numeric values are treated as pixels.When string is used the format can be "number" + "px" or "number" alone. For example: "100px" or "100".
public double? Height { get; set; }
Defines what loader will be used while loading the data. Possible values are: "loadingPanel" - a panel with a circular loading indicator. or "skeleton" - a skeleton enabled loader..
public GridLoaderType? LoaderType { get; set; }
Can be set to "phone". This will force the Grid to use adaptive rendering regardless of browser type.
public string Mobile { get; set; }
If set to true and the Grid is viewed on mobile browser it will use adaptive rendering.
public bool? MobileEnabled { get; set; }
If set to true the user could navigate the component using the keyboard navigation. By default keyboard navigation is disabled.
public bool? Navigatable { get; set; }
The name of the JavaScript function that will handle the beforeEdit event. Fired when the user tries to edit or create a data item, before the editor is created. Can be used to preventing editing according to any custom logic.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnBeforeEdit { get; set; }
The name of the JavaScript function that will handle the cancel event. Fired when the user clicks the "cancel" button (in inline or popup editing mode) or closes the popup window.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnCancel { get; set; }
The name of the JavaScript function that will handle the cellClose event. Fired when "incell" edit mode is used and the cell is going to be closed. The event is triggerd after saving or canceling the changes, but before the cell is closed.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnCellClose { get; set; }
The name of the JavaScript function that will handle the change event. Fired when the user selects or deselects a table row or cell in the grid. To retrieve the selected elements, use the select method.The event handler function context (available via the this keyword) will be set to the widget instance.The event will be fired only when the Grid is selectable.
public string OnChange { get; set; }
The name of the JavaScript function that will handle the changing event. Fired when the user is about to select a table row or cell.The event will be fired only when the Grid is selectable.
public string OnChanging { get; set; }
The name of the JavaScript function that will handle the columnHide event. Fired when the user hides a column.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnColumnHide { get; set; }
The name of the JavaScript function that will handle the columnLock event. Fired when the user lock a column.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnColumnLock { get; set; }
The name of the JavaScript function that will handle the columnMenuInit event. Fired when the column menu is initialized.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnColumnMenuInit { get; set; }
The name of the JavaScript function that will handle the columnMenuOpen event. Fired when the grid column menu is opened, after the animations are completed.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnColumnMenuOpen { get; set; }
The name of the JavaScript function that will handle the columnReorder event. Fired when the user changes the order of a column.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnColumnReorder { get; set; }
The name of the JavaScript function that will handle the columnResize event. Fired when the user resizes a column.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnColumnResize { get; set; }
The name of the JavaScript function that will handle the columnShow event. Fired when the user shows a column.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnColumnShow { get; set; }
The name of the JavaScript function that will handle the columnStick event. Fired when the user sticks a column.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnColumnStick { get; set; }
The name of the JavaScript function that will handle the columnUnlock event. Fired when the user unlock a column.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnColumnUnlock { get; set; }
The name of the JavaScript function that will handle the columnUnstick event. Fired when the user unsticks a column.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnColumnUnstick { get; set; }
The name of the JavaScript function that will handle the csvExport event. Fired when the user clicks the "Export to CSV" toolbar button.
public string OnCsvExport { get; set; }
The name of the JavaScript function that will handle the dataBinding event. Fired before the widget binds to its data source.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnDataBinding { get; set; }
The name of the JavaScript function that will handle the dataBound event. Fired when the widget is bound to data from its data source.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnDataBound { get; set; }
The name of the JavaScript function that will handle the detailCollapse event. Fired when the user collapses a detail table row.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnDetailCollapse { get; set; }
The name of the JavaScript function that will handle the detailExpand event. Fired when the user expands a detail table row.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnDetailExpand { get; set; }
The name of the JavaScript function that will handle the detailInit event. Fired when a detail table row is initialized.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnDetailInit { get; set; }
The name of the JavaScript function that will handle the edit event. Fired when the user edits or creates a data item.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnEdit { get; set; }
The name of the JavaScript function that will handle the excelExport event. Fired when the user clicks the "Export to Excel" toolbar button.
public string OnExcelExport { get; set; }
The name of the JavaScript function that will handle the filter event. Fired when the user is about to filter the DataSource via the filter UI.The event handler function context (available via the this keyword) will be set to the widget instance.Introduced in the Kendo UI 2016 R3 (2016.3.914) release.
public string OnFilter { get; set; }
The name of the JavaScript function that will handle the filterMenuInit event. Fired when the grid filter menu is initialized, when it is opened for the first time.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnFilterMenuInit { get; set; }
The name of the JavaScript function that will handle the filterMenuOpen event. Fired when the grid filter menu is opened, after the animations are completed.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnFilterMenuOpen { get; set; }
The name of the JavaScript function that will handle the group event. Fired when the user is about to group the DataSource or modify the group descriptors state via the Grid group panel.The event handler function context (available via the this keyword) will be set to the widget instance.Introduced in the Kendo UI 2016 R3 (2016.3.914) release.
public string OnGroup { get; set; }
The name of the JavaScript function that will handle the groupCollapse event. Fired when the user collapses a group row.The event handler function context (available via the this keyword) will be set to the widget instance.Introduced in the Kendo UI 2017 R3 (2017.3.913) release.
public string OnGroupCollapse { get; set; }
The name of the JavaScript function that will handle the groupExpand event. Fired when the user expands a group row.The event handler function context (available via the this keyword) will be set to the widget instance.Introduced in the Kendo UI 2017 R3 (2017.3.913) release.
public string OnGroupExpand { get; set; }
The name of the JavaScript function that will handle the kendoKeydown event. Triggered when the user presses a keyboard key while the Grid is focused.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnKendoKeydown { get; set; }
The name of the JavaScript function that will handle the navigate event. Fired when navigatable is enabled and the user change current item with either mouse or keyboard interaction.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnNavigate { get; set; }
The name of the JavaScript function that will handle the page event. Fired when the user is about change the current page index of DataSource via the pager UI.The event handler function context (available via the this keyword) will be set to the widget instance.Introduced in the Kendo UI 2016 R3 (2016.3.914) release.
public string OnPage { get; set; }
The name of the JavaScript function that will handle the paste event. Fired when the user pastes data using the Grid's built-in paste mechanism.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnPaste { get; set; }
The name of the JavaScript function that will handle the pdfExport event. Fired when the user clicks the "Export to PDF" toolbar button.
public string OnPdfExport { get; set; }
The name of the JavaScript function that will handle the remove event. Fired when the user clicks the "destroy" command button and delete operation is confirmed in the confirmation window, if the cancel button in the window is clicked the event will not be fired.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnRemove { get; set; }
The name of the JavaScript function that will handle the rowPin event. Fired when a row is pinned.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnRowPin { get; set; }
The name of the JavaScript function that will handle the rowReorder event. Fired when the user changes the order of a row.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnRowReorder { get; set; }
The name of the JavaScript function that will handle the rowResize event. Fired when the user resizes a row (rows).The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnRowResize { get; set; }
The name of the JavaScript function that will handle the rowUnpin event. Fired when a row is unpinned.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnRowUnpin { get; set; }
The name of the JavaScript function that will handle the save event. Fired when a data item is saved.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnSave { get; set; }
The name of the JavaScript function that will handle the saveChanges event. Fired when the user clicks the "Save changes" command button in the toolbar.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnSaveChanges { get; set; }
The name of the JavaScript function that will handle the sort event. Fired when the user is about to modify the current state of sort descriptors of DataSource via the sort UI.The event handler function context (available via the this keyword) will be set to the widget instance.Introduced in the Kendo UI 2016 R3 (2016.3.914) release.
public string OnSort { get; set; }
Sets a value indicating whether the selection will be persisted when sorting, paging, filtering and etc are performed.
public bool? PersistSelection { get; set; }
A function that allows customizing the rendering of pinned rows. The function receives an object with two fields: dataItem (the data item for the row) and row (the default HTML string for the row). The function must return an HTML string.If not set, pinned rows use the same template as regular rows. This option expects the name of a JavaScript function that will be called to return the template.
public string PinnedRowTemplateHandler { get; set; }
If set to true, column resizing will be enabled. Use the resizable TagHelper to enable row resizing
[HtmlAttributeName("resizable")]
public bool? ResizableEnabled { get; set; }
The id of the template used for rendering the rows in the grid.
public string RowTemplate { get; set; }
The id of the template used for rendering the rows in the grid. This option expects the name of a JavaScript function that will be called to return the template.
public string RowTemplateHandler { get; set; }
The id of the template used for rendering the rows in the grid. This option expects the ID of the script element that contains the template.
public string RowTemplateId { get; set; }
The id of the template used for rendering the rows in the grid. This option expects the IHtmlContent instance containing the created HTML.
public IHtmlContent RowTemplateView { get; set; }
Specifies the selection type of the grid.
public string Selectable { get; set; }
Specifies the size of the Grid.
public ComponentSize? Size { get; set; }
The template which renders the Status Bar/Aggregates Bar. This option expects the name of a JavaScript function that will be called to return the template.
public string StatusBarTemplateHandler { get; set; }
Configures the templates for the component.
[HtmlAttributeNotBound]
public IDictionary<string, string> Templates { get; }
Implements:
Methods
Gets the initialization script.
protected override string GetInitializationScript()
The initialization script.
Overrides:
public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
Overrides:
Serializes the defined settings.
public override IDictionary<string, object> Serialize()
Overrides:
SerializeEvents method.
protected override Dictionary<string, object> SerializeEvents()
Overrides:
SerializeSettings method.
protected override Dictionary<string, object> SerializeSettings()
Overrides:
Writes the HTML output.
protected override void WriteHtml(TagHelperOutput output)
The TagHelper output.
Overrides: