ClassTelerikGrid<TItem>
The class for the Telerik Grid component.
Definition
Namespace:Telerik.Blazor.Components
Assembly:Telerik.Blazor.dll
Type Parameters:
TItem
The type of the model to which the grid is bound.
Syntax:
public class TelerikGrid<TItem> : TableGridBase<TItem, GridCommandEventArgs>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Inheritance: objectComponentBaseBaseComponentDataBoundComponent<TItem>GridBase<TItem>TableGridBase<TItem, GridCommandEventArgs>TelerikGrid<TItem>
Implements:
Inherited Members
Constructors
TelerikGrid()
Declaration
public TelerikGrid()
Properties
AdaptiveMode
Defines the adaptive mode of the grid. The available values are None(default) and Auto. When set to auto and the width of the window is less than 768px or Medium, actionsheet is rendered for components that have popups.
Declaration
[Parameter]
public AdaptiveMode AdaptiveMode { get; set; }
Property Value
DataLayoutMode
Defines the layout mode of the Grid. Use Stacked to enable the stacked layout with expandable rows showing additional data in a card-like format.
Declaration
[Parameter]
public GridDataLayoutMode DataLayoutMode { get; set; }
Property Value
DetailTemplate
Template displayed in expandable rows below the main row data. Use this to create master-detail views with nested content for each row. Not compatible with virtual scrolling (Virtual).
Declaration
[Parameter]
public RenderFragment<TItem> DetailTemplate { get; set; }
Property Value
RenderFragment<TItem>
EditMode
Enables data editing and determines the editing interface. Use None to disable editing entirely, Inline to edit entire rows directly in the grid, Popup to open a modal dialog with edit form, or Incell to edit individual cells separately (not compatible with cell selection). The default mode is None.
Declaration
[Parameter]
public GridEditMode EditMode { get; set; }
Property Value
FilterMode
Enables data filtering and determines the filter interface. Use None to disable filtering entirely, FilterRow to show inline filter controls below column headers, or FilterMenu to show filter options in dropdown menus accessed from column headers.
Declaration
[Parameter]
public GridFilterMode FilterMode { get; set; }
Property Value
GridExport
Contains export configuration for Excel, CSV, and PDF export functionality. Use this to enable data export from the Grid. Children: GridExcelExport, GridCsvExport, GridPdfExport.
Declaration
[Parameter]
public RenderFragment GridExport { get; set; }
Property Value
GridPagerTemplate
Custom pager template that replaces the default pagination controls at the bottom of the Grid. Use this to create custom pagination UI.
Declaration
[Parameter]
public RenderFragment GridPagerTemplate { get; set; }
Property Value
GridSettings
Contains additional Grid configuration options like pager, popup edit, row dragging, selection, and validation settings. Children: GridPagerSettings, GridPopupEditSettings, GridRowDraggableSettings, GridSelectionSettings, GridValidationSettings.
Declaration
[Parameter]
public RenderFragment GridSettings { get; set; }
Property Value
GridToolBar
Contains predefined toolbar tools like Add, Export, Search, and Select All buttons that appear above the Grid columns. Cannot be used simultaneously with GridToolBarTemplate - choose either the strongly-typed toolbar or the custom template. Children: GridCommandButton, GridSearchBox, GridToolBarAddTool, GridToolBarCsvExportTool, GridToolBarExcelExportTool, GridToolBarSearchBoxTool, GridToolBarSelectAllTool, GridToolBarSpacerTool.
Declaration
[Parameter]
public RenderFragment GridToolBar { get; set; }
Property Value
GridToolBarTemplate
Custom toolbar template that appears above the Grid columns. Use this to create custom toolbar content instead of predefined toolbar tools. Cannot be used simultaneously with GridToolBar - choose either the template or the strongly-typed toolbar.
Declaration
[Parameter]
public RenderFragment GridToolBarTemplate { get; set; }
Property Value
Groupable
Enables data grouping by dragging column headers to a group panel and allows users to expand/collapse groups to organize data hierarchically. When using virtual scrolling (Virtual), grouping requires LoadGroupsOnDemand to be enabled. Programmatic grouping via SetStateAsync(GridState<TItem>) is always possible.
HighlightedCells
Collection of specific cells to visually highlight in the Grid. Use this to emphasize individual cells with different styling.
Declaration
[Parameter]
public List<GridHighlightedCellDescriptor> HighlightedCells { get; set; }
Property Value
HighlightedItems
Collection of data items to visually highlight in the Grid. Use this to emphasize specific rows with different styling.
Declaration
[Parameter]
public List<TItem> HighlightedItems { get; set; }
Property Value
List<TItem>
LoadGroupsOnDemand
Loads group data only when expanded by the user, improving performance with large grouped datasets. All groups start collapsed when enabled. This must be enabled when using Groupable with virtual scrolling (Virtual).
Declaration
[Parameter]
public bool LoadGroupsOnDemand { get; set; }
Property Value
NewRowPosition
Controls where new rows appear when adding data. Set to Top to insert at the beginning or Bottom to insert at the end of the Grid. Default value is Top.
Declaration
[Parameter]
public GridNewRowPosition NewRowPosition { get; set; }
Property Value
OnRead
Fires when the Grid needs data from a remote source. Handle this event to implement custom data operations like paging, sorting, filtering, and grouping. sorting, filtering, grouping and paging. Once OnRead is attached, you must implement all such data source operations here. The Component will no longer perform them for you.
Declaration
[Parameter]
public EventCallback<GridReadEventArgs> OnRead { get; set; }
Property Value
OnRowClick
Fires when user clicks on a Grid row or presses Enter while a row has focus. Use this to handle row selection or navigation.
Declaration
[Parameter]
public EventCallback<GridRowClickEventArgs> OnRowClick { get; set; }
Property Value
OnRowCollapse
Fires when user collapses a detail row to hide nested content. Use this to clean up resources or track row collapse state.
Declaration
[Parameter]
public EventCallback<GridRowCollapseEventArgs> OnRowCollapse { get; set; }
Property Value
OnRowContextMenu
Fires when user right-clicks on a Grid row or uses context menu key. Use this to display custom context menus for row actions.
Declaration
[Parameter]
public EventCallback<GridRowClickEventArgs> OnRowContextMenu { get; set; }
Property Value
OnRowDoubleClick
Fires when user double-clicks on a Grid row. Use this to trigger actions like opening edit forms or navigation.
Declaration
[Parameter]
public EventCallback<GridRowClickEventArgs> OnRowDoubleClick { get; set; }
Property Value
OnRowDrop
Fires when user completes dragging a Grid row to a new position. Enable RowDraggable to allow row reordering by drag and drop.
Declaration
[Parameter]
public EventCallback<GridRowDropEventArgs<TItem>> OnRowDrop { get; set; }
Property Value
EventCallback<GridRowDropEventArgs<TItem>>
OnRowExpand
Fires when user expands a detail row to show nested content. Use this to load detail data or track row expansion state.
Declaration
[Parameter]
public EventCallback<GridRowExpandEventArgs> OnRowExpand { get; set; }
Property Value
OnRowRender
Fires every time a Grid row is rendered. Use this to conditionally apply custom CSS classes or styling to rows based on data.
Declaration
[Parameter]
public Action<GridRowRenderEventArgs> OnRowRender { get; set; }
Property Value
OnStateChanged
Fires whenever Grid state changes due to user actions like sorting, filtering, paging, or grouping. Use this to save state for persistence.
Declaration
[Parameter]
public EventCallback<GridStateEventArgs<TItem>> OnStateChanged { get; set; }
Property Value
EventCallback<GridStateEventArgs<TItem>>
OnStateInit
Fires during Grid initialization when state can be loaded from external storage. Use this to restore saved Grid settings like sorting and filtering. Useful when you'd like to persist changed on page reloads.
Declaration
[Parameter]
public EventCallback<GridStateEventArgs<TItem>> OnStateInit { get; set; }
Property Value
EventCallback<GridStateEventArgs<TItem>>
ScrollMode
Controls how the Grid handles large datasets. Use Scrollable for standard scrolling that renders all data and requires setting the Grid's Height, or Virtual for performance optimization with large datasets that renders only visible items during scrolling. When using Virtual, you must also set RowHeight and Height. Virtual scrolling is not compatible with Groupable (unless LoadGroupsOnDemand is true), Pageable, or DetailTemplate.
Declaration
[Parameter]
public GridScrollMode ScrollMode { get; set; }
Property Value
SelectedCells
Collection of currently selected cells when cell selection is enabled. Supports two-way binding for programmatic selection management.
Declaration
[Parameter]
public IEnumerable<GridSelectedCellDescriptor> SelectedCells { get; set; }
Property Value
SelectedCellsChanged
Fires when cell selection changes. Use this event to respond to user selecting or deselecting cells in the Grid.
Declaration
[Parameter]
public EventCallback<IEnumerable<GridSelectedCellDescriptor>> SelectedCellsChanged { get; set; }
Property Value
SelectionMode
Enables row or cell selection and determines selection behavior. Use None to disable selection entirely, Single to allow selecting only one row at a time, or Multiple to enable multi-row selection with Ctrl+click and Shift+click.
Declaration
[Parameter]
public GridSelectionMode SelectionMode { get; set; }
Property Value
Methods
AutoFitAllColumnsAsync()
Sets the minimum possible widths to all Grid columns, so that there is no text wrapping.
AutoFitColumnAsync(string)
Sets the minimum possible width to a Grid column, so that there is no text wrapping.
AutoFitColumnsAsync(IEnumerable<string>)
Sets the minimum possible widths to multiple Grid columns, so that there is no text wrapping.
Declaration
public Task AutoFitColumnsAsync(IEnumerable<string> ids)
Parameters
ids
The Id values of the columns to autofit.
Returns
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builder
Overrides
Dispose()
Declaration
public override void Dispose()
Overrides
ExportToCsvAsync()
Exports the Grid to a MemoryStream that can be saved as a CSV file.
Declaration
public Task<MemoryStream> ExportToCsvAsync()
Returns
ExportToCsvAsync(GridCsvExportOptions)
Exports the Grid to a MemoryStream that can be saved as a CSV file.
Declaration
public Task<MemoryStream> ExportToCsvAsync(GridCsvExportOptions options)
Parameters
options
Returns
ExportToExcelAsync()
Exports the Grid to a MemoryStream that can be saved as an Excel file.
Declaration
public Task<MemoryStream> ExportToExcelAsync()
Returns
ExportToExcelAsync(GridExcelExportOptions)
Exports the Grid to a MemoryStream that can be saved as an Excel file.
Declaration
public Task<MemoryStream> ExportToExcelAsync(GridExcelExportOptions options)
Parameters
options
Returns
ExportToPdfAsync()
Exports the Grid to a MemoryStream that can be saved as a CSV file.
Declaration
public Task<MemoryStream> ExportToPdfAsync()
Returns
GetAIRequest()
Get an AI request.
Declaration
public GridAIRequestDescriptor GetAIRequest()
Returns
GetAIRequest(string)
Get an AI request.
Declaration
public GridAIRequestDescriptor GetAIRequest(string prompt)
Parameters
prompt
Returns
GetAIResult(string)
Processes a Grid AI response.
Declaration
public GridAIResultDescriptor<TItem> GetAIResult(string aiResponseAsString)
Parameters
aiResponseAsString
Returns
GridAIResultDescriptor<TItem>
GetItemFromDropIndex(int)
Declaration
protected override TItem GetItemFromDropIndex(int index)
Parameters
index
Returns
TItem
Overrides
GetState()
Gets the current state of the Grid. Includes grouping, filtering, edit items, column state, etc.
ProcessAIResponseAsync(string)
Processes an AI request.
SaveAsCsvFileAsync()
Exports the Grid to a file and sends it to the browser for download.
SaveAsCsvFileAsync(GridCsvExportOptions)
Exports the Grid to a file and sends it to the browser for download.
Declaration
public ValueTask SaveAsCsvFileAsync(GridCsvExportOptions options)
Parameters
options
Returns
SaveAsExcelFileAsync()
Exports the grid to a file and sends it to the browser for download.
SaveAsExcelFileAsync(GridExcelExportOptions)
Exports the grid to a file and sends it to the browser for download.
Declaration
public ValueTask SaveAsExcelFileAsync(GridExcelExportOptions options)
Parameters
options
Returns
SaveAsPdfFileAsync()
Exports the Grid to a file and sends it to the browser for download.
SetParametersAsync(ParameterView)
Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
parameters
Returns
Overrides
SetSkip(int)
Declaration
protected override void SetSkip(int skip)
Parameters
skip
Overrides
SetStateAsync(GridState<TItem>)
Changes the state of the Grid. Includes all properties, which are controlled by the user - grouping, filtering, edit items, column state, etc.