alexa
menu

Blazor

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

    Show / Hide Table of Contents

    Class BeforeAutoFillCellEventArgs<T>

    Provides event arguments for the BeforeAutoFillCell event, which occurs before a cell value is autofilled.

    Inheritance
    object
    GridEventBaseArgs
    AfterAutoFillCellEventArgs<T>
    BeforeAutoFillCellEventArgs<T>
    Inherited Members
    AfterAutoFillCellEventArgs<T>.ColumnIndex
    AfterAutoFillCellEventArgs<T>.ColumnName
    AfterAutoFillCellEventArgs<T>.Data
    AfterAutoFillCellEventArgs<T>.RowIndex
    GridEventBaseArgs.PreventRender
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Syncfusion.Blazor.Grids
    Assembly: Syncfusion.Blazor.Grids.dll
    Syntax
    public class BeforeAutoFillCellEventArgs<T> : AfterAutoFillCellEventArgs<T>
    Type Parameters
    Name Description
    T

    The data type of the grid's row data.

    Remarks

    This event arguments class supports cell-level control over autofill operations through cancellation and value modification capabilities. Enables implementation of validation rules, conditional value transformations, and selective cell population to enforce business logic constraints.

    Examples

    The following example shows how to cancel and modify autofill operations based on custom business rules:

    <SfGrid DataSource="@Orders" EnableAutoFill="true" @ref="DefaultGrid" >
        <GridSelectionSettings CellSelectionMode="CellSelectionMode.Box" Mode="SelectionMode.Cell" Type="SelectionType.Multiple"></GridSelectionSettings>
        <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
        <GridEvents TValue="Order" BeforeAutoFillCell="OnBeforeAutoFillCell"></GridEvents>
    ...
    </SfGrid>
    ...
    private void OnBeforeAutoFillCell(BeforeAutoFillCellEventArgs<Order> args)
    {
        // Cancel autofill for invalid quantities
        if (args.ColumnName == "Quantity" && (int)args.Value <= 0)
        {
            args.Cancel = true;
        }
    
        // Apply 15% markup to UnitPrice
        if (args.ColumnName == "UnitPrice")
        {
             args.Value = Convert.ToDecimal(args.Value) * 1.15m;
        }
    }

    Constructors

    BeforeAutoFillCellEventArgs()

    Declaration
    public BeforeAutoFillCellEventArgs()

    Properties

    Cancel

    Gets or sets a value indicating whether to cancel the autofill action for the current cell.

    Declaration
    public bool Cancel { get; set; }
    Property Value
    Type Description
    bool

    true to cancel the autofill operation for this cell; otherwise, false. The default value is false.

    Remarks

    Set this property to true in the event handler to prevent the autofill value from being applied to the current cell. This allows for custom validation or conditional cell population logic.

    Value

    Gets or sets the value to be autofilled into the current cell.

    Declaration
    public object? Value { get; set; }
    Property Value
    Type Description
    object

    The autofill value, which is determined by the autofill operation mode and the source cell value. You can modify this property to customize the value being populated into the cell before it is applied. The default is null.

    Remarks

    Enables modification of the autofill value before it is committed to the cell. Supports use cases such as value transformations, applying business rule-based defaults, and enforcing conditional constraints on cell values.

    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved