alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class GridTemplates

    Configures grid templates.

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    GridTemplates
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.BuildRenderTree(RenderTreeBuilder)
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnAfterRenderAsync(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.Dispose(bool)
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    Namespace: Syncfusion.Blazor.Grids
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class GridTemplates : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

    Constructors

    GridTemplates()

    Declaration
    public GridTemplates()

    Properties

    DetailTemplate

    Gets or sets the template to customize detail row element.

    Declaration
    [Parameter]
    [JsonIgnore]
    public RenderFragment<object> DetailTemplate { get; set; }
    Property Value
    Type
    RenderFragment<object>
    Remarks

    Use DetailTemplate to render hierarchy grid. It supports N level of nested grids. The parameters passed to the templates can be accessed using implicit parameter named context. The context is of type TValue.

    EmptyRecordTemplate

    Gets or sets the template to customize empty grid row element.

    Declaration
    [Parameter]
    [JsonIgnore]
    public RenderFragment<EmptyRecordTemplateContext> EmptyRecordTemplate { get; set; }
    Property Value
    Type
    RenderFragment<EmptyRecordTemplateContext>
    Remarks

    The parameters passed to the templates can be accessed using implicit parameter named context. The context is of type EmptyRecordTemplateContext.

    RowTemplate

    Gets or sets the row template to customize row elements.

    Declaration
    [Parameter]
    [JsonIgnore]
    public RenderFragment<object> RowTemplate { get; set; }
    Property Value
    Type
    RenderFragment<object>
    Remarks

    The RowTemplate content must be TD elements and the number of TD elements must match the number of datagrid columns. The parameters passed to the templates can be accessed using implicit parameter named context. The context is of type TValue.

    ToolbarTemplate

    Render custom toolbar using ToolbarTemplate property. It replaces the in-built toolbar and click actions must be handled in custom toolbar itself.

    Declaration
    [Parameter]
    [JsonIgnore]
    public RenderFragment<object> ToolbarTemplate { get; set; }
    Property Value
    Type
    RenderFragment<object>
    Remarks

    The parameters passed to the templates can be accessed using implicit parameter named context.

    TooltipTemplate

    Gets or sets a template to customize the tooltip content when hovering over grid cells and headers.

    Declaration
    [Parameter]
    [JsonIgnore]
    public RenderFragment<TooltipTemplateContext> TooltipTemplate { get; set; }
    Property Value
    Type Description
    RenderFragment<TooltipTemplateContext>

    A RenderFragment<TValue> used to define custom tooltip content. No default value.

    Remarks

    This template enables rich customization of tooltip content in the Blazor DataGrid. It is rendered when tooltips are enabled via the ShowTooltip property.

    The template receives a context parameter of type TooltipTemplateContext, which provides access to relevant data such as the grid column, row data, and cell value.

    To activate tooltip, ensure that the ShowTooltip property is set to true. Without this setting, the TooltipTemplate will not be rendered.

    This feature is useful for displaying additional contextual information, such as formatted values, icons, or images—especially when working with templated columns or truncated content.

    Examples

    Demonstrates how to define a custom TooltipTemplate to display enhanced tooltip content.

    <SfGrid DataSource="@Orders" ShowTooltip="true">
    <GridTemplates>
    <TooltipTemplate>
    var tooltip = context as TooltipTemplateContext;
    <span><b>@tooltip.Value</b></span>
    </TooltipTemplate>
    </GridTemplates>
    <GridColumns>
    <GridColumn Field="CustomerID" HeaderText="Customer ID" Width="150"></GridColumn>
    </GridColumns>
    </SfGrid>
    
    @code {
    public class Order
    {
    public string CustomerID { get; set; }
    }
    }

    Methods

    OnInitializedAsync()

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type
    Task
    Overrides
    ComponentBase.OnInitializedAsync()

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved