Class BeforeAutoFillCellEventArgs<T>
Provides event arguments for the BeforeAutoFillCell event, which occurs before a cell value is autofilled.
Inherited Members
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 |
|
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 |
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.