Class GridEvents<TValue>
Configures grid events.
Inheritance
Namespace: Syncfusion.Blazor.Grids
Assembly: Syncfusion.Blazor.dll
Syntax
public class GridEvents<TValue> : OwningComponentBase
Type Parameters
Name |
---|
TValue |
Constructors
GridEvents()
Declaration
public GridEvents()
Properties
BeforeAutoFill
Gets or sets the event callback that is raised before the autofill action.
Declaration
public EventCallback<BeforeAutoFillEventArgs> BeforeAutoFill { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeAutoFillEventArgs> | An event callback function. |
Remarks
This event handler receives a BeforeAutoFill object which provides the details of before autofill action. Also,this event triggers when you release the dragged fill handle icon. You can cancel the entire cells getting automatically filled in the cell.
Examples
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" BeforeAutoFill="BeforeAutoFillAction"></GridEvents>
........
</SfGrid>
@code{
public async Task BeforeAutoFillAction(BeforeAutoFillEventArgs args)
{
//you can cancel the autofill action here.
args.Cancel = true;
}
}
BeforeAutoFillCell
Gets or sets the event callback that is raised before the autofill action sets the value for each cell. You can cancel the autofill action for particular cell or change the value by using this event.
Declaration
public EventCallback<BeforeAutoFillCellEventArgs<TValue>> BeforeAutoFillCell { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeAutoFillCellEventArgs<TValue>> | An event callback function. |
Remarks
This event occurs after the BeforeAutoFill event if that event is not canceled. This event handler receives a BeforeAutoFillCell object which provides the details of before autofill action.
Examples
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" BeforeAutoFillCell="BeforeAutoFillCellAction"></GridEvents>
........
</SfGrid>
@code{
public async Task BeforeAutoFillCellAction(BeforeAutoFillCellEventArgs<Orders> args)
{
if(args.ColumnIndex == 1 && args.RowIndex == 5)
{
//you can modified the content to be paste here.
args.Value = "Modified Value";
}
}
BeforeCellPaste
An event that is raised before pasting the copied cell value for each cell. You can cancel the pasting action for particular cell or change the value by using this event.
Declaration
public EventCallback<BeforeCellPasteEventArgs<TValue>> BeforeCellPaste { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeCellPasteEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a BeforeCellPasteEventArgs<T> object which provides the details of before pasting the copied cell value in the current cell.
Examples
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" BeforeCellPaste="Paste"></GridEvents>
........
</SfGrid>
@code{
public async Task Paste(BeforeCellPasteEventArgs<Orders> args)
{
if(ColumnIndex == 1 && RowIndex == 4){
//you can modified the content to be paste here.
args.CellValue = "Modified value";
}
}
BeforeCopyPaste
An event that is raised before copy or paste action in the Grid cells. You can cancel this entire copy or paste action by using this event.
Declaration
public EventCallback<BeforeCopyPasteEventArgs> BeforeCopyPaste { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeCopyPasteEventArgs> | An event callback function. |
Remarks
This event triggers before BeforeCellPasteEventArgs<T> event, so you can cancel entire pasting operation by using this event. Also, this event handler receives a BeforeCopyPasteEventArgs object which provides the details of before paste/copy action.
Examples
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" BeforeCopyPaste="Copy"></GridEvents>
........
</SfGrid>
@code{
public async Task Copy(BeforeCopyPasteEventArgs args)
{
//you can cancel the entire copy action here
if(args.Action == "Copy"){
args.Cancel = true;
}
// you can cancel the entire paste action here
if(args.Action == "Paste"){
args.Cancel = true;
}
}
BeforeOpenColumnChooser
Gets or sets an event callback that is raised before the column chooser dialog is open while click the columns icon in the toolbar. The column chooser allows the user to show or hide columns by changing the state of the checkbox.
Declaration
public EventCallback<ColumnChooserEventArgs> BeforeOpenColumnChooser { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ColumnChooserEventArgs> | An event callback function. |
Remarks
This event handler receives a
Examples
<SfGrid ShowColumnChooser="true" Toolbar="@(new List<string>() { "ColumnChooser" })">
<GridEvents BeforeOpenColumnChooser="BeforeOpenColumnChooserHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void BeforeOpenColumnChooserHandler(ColumnChooserEventArgs Args)
{
args.Cancel = true;
}
}
CellDeselected
Gets or sets an event callback that is raised after a selected cell is deselected in the grid. If a cell is selected and click on to any other cell or pressing Tab or arrow keys without pressing Ctrl or Shift key or programmatically, then the previously selected cell will be deselected.
Declaration
public EventCallback<CellDeselectEventArgs<TValue>> CellDeselected { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<CellDeselectEventArgs<TValue>> | An event callback function. |
Remarks
This event is raised when SelectionMode as Cell or Both.
The deselection of a cell is prevented using the CellDeselecting event, then the CellDeselected
event will not be raised.
Examples
<SfGrid DataSource="@Orders">
<GridEvents CellDeselected="CellDeselectHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void CellDeselectHandler(CellDeselectEventArgs<Order> args)
{
}
}
CellDeselecting
Gets or sets an event callback that is raised before any cell deselection occurs in the grid. If a cell is selected and click on to any other cell or pressing Tab or arrow keys without pressing Ctrl or Shift key or programmatically, then the previously selected cell will be deselected.
Declaration
public EventCallback<CellDeselectEventArgs<TValue>> CellDeselecting { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<CellDeselectEventArgs<TValue>> | An event callback function. |
Remarks
This event is raised when SelectionMode is set to Cell or Both.
You can prevent the cell deselection action by setting
Examples
<SfGrid DataSource="@Orders">
<GridEvents CellDeselecting="CellDeselectingHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void CellDeselectingHandler(CellDeselectEventArgs<Order> args)
{
args.Cancel = true;
}
}
CellSaved
Gets or sets an event callback that is raised after cell changes are updated in the grid user interface and the edited values are highlighted in the grid.
Declaration
public EventCallback<CellSavedArgs<TValue>> CellSaved { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<CellSavedArgs<TValue>> | An event callback function. |
Remarks
The cell save action is prevented using the OnCellSave event, then the CellSaved
event will not be raised.
Examples
<SfGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<GridEvents CellSaved="CellSavedHandler" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
</SfGrid>
@code {
public void CellSavedHandler(CellSavedArgs<Order> args)
{
}
}
CellSelected
Gets or sets an event callback that is raised after a cell is selected in the grid. Cell selection can be done by click on the cell or pressing arrow keys with/without pressing Shift or Ctrl keys or programmatically.
Declaration
public EventCallback<CellSelectEventArgs<TValue>> CellSelected { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<CellSelectEventArgs<TValue>> | An event callback function. |
Remarks
This event is raised when SelectionMode as Cell or Both.
The selection of a cell is prevented using the CellSelecting event, then the CellSelected
event will not be raised.
Examples
<SfGrid DataSource="@Orders">
<GridEvents CellSelected="CellselectHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void CellselectHandler(CellSelectEventArgs<Order> args)
{
}
}
CellSelecting
Gets or sets an event callback that is raised before any cell selection occurs in the grid. Cell selection can be done by click on the cell or pressing Shift/Ctrl and click on the cell or pressing arrow keys with or without pressing Shift/Ctrl keys after selecting any cell.
Declaration
public EventCallback<CellSelectingEventArgs<TValue>> CellSelecting { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<CellSelectingEventArgs<TValue>> | An event callback function. |
Remarks
This event is raised when SelectionMode as Cell and Both. You can prevent the cell selection action by setting Cancel to true.
Examples
<SfGrid DataSource="@Orders">
<GridEvents CellSelecting="CellselectingHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void CellselectingHandler(CellSelectingEventArgs<Order> args)
{
args.Cancel = true;
}
}
CheckboxFilterSearching
Gets or sets the event callback that is raised when values get filtered using search bar in CheckBox and Excel filter.
Declaration
public EventCallback<CheckboxFilterSearchingEventArgs> CheckboxFilterSearching { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<CheckboxFilterSearchingEventArgs> | An event callback function. |
Remarks
The event handler receives a CheckboxFilterSearchingEventArgs object, which provides details about the values get filtered using search bar in checkbox filter and excel filter in the grid.
Examples
This example shows how to handle the CheckboxFilterSearching event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" CheckboxFilterSearching="CheckboxFilterSearchHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task CheckboxFilterSearchingHandler(CheckboxFilterSearchEventArgs args)
{
}
ColumnMenuItemClicked
Gets or sets an event callback that is raised after clicking on a column menu item in a grid.
Declaration
public EventCallback<ColumnMenuClickEventArgs> ColumnMenuItemClicked { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ColumnMenuClickEventArgs> | An event callback function. |
Remarks
This event handler receives a ColumnMenuClickEventArgs object, which contains corresponding menu item and GridColumn. You can perform custom actions for column menu items within this event handler.
Examples
<SfGrid DataSource="@Orders" AllowGrouping="true" AllowFiltering="true" AllowPaging="true" ShowColumnMenu="true">
<GridEvents ColumnMenuItemClicked="ColumnMenuItemClickedHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void ColumnMenuItemClickedHandler(ColumnMenuClickEventArgs args)
{
}
}
ColumnReordered
Gets or sets the event callback that is raised when columns are reordered in the grid.
Declaration
public EventCallback<ColumnReorderedEventArgs> ColumnReordered { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ColumnReorderedEventArgs> | An event callback function. |
Remarks
The event handler receives a ColumnReorderedEventArgs object, which provides details about the columns reordered in the grid.
Examples
This example shows how to handle the ColumnReordered event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" ColumnReordered ="ColumnReorderedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task ColumnReorderedHandler(ColumnReorderedEventArgs args)
{
var toColumn = args.ToColumn; // To get the to columns list
}
ColumnReordering
Gets or sets the event callback that is raised when columns reordering action is performed in the grid.
Declaration
public EventCallback<ColumnReorderingEventArgs> ColumnReordering { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ColumnReorderingEventArgs> | An event callback function. |
Remarks
The event handler receives a ColumnReorderingEventArgs object, which provides details about the columns reordering action in the grid.
Examples
This example shows how to handle the ColumnReordering event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" ColumnReordering ="ColumnReorderingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task ColumnReorderingHandler(ColumnReorderingEventArgs args)
{
var fromColumn = args.FromColumn; // To get the from columns list
}
ColumnVisibilityChanged
Gets or sets the event callback that is raised when the grid's column visibility is changed.
Declaration
public EventCallback<ColumnVisibilityChangedEventArgs> ColumnVisibilityChanged { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ColumnVisibilityChangedEventArgs> | An event callback function. |
Remarks
The event handler receives a ColumnVisibilityChangedEventArgs object, which provides details about the columns and the action performed (show or hide) in the grid.
Examples
This example shows how to handle the ColumnVisibilityChanged event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" ColumnVisibilityChanged ="ColumnVisibilityChangedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task ColumnVisibilityChangedHandler(ColumnVisibilityChangedEventArgs args)
{
}
ColumnVisibilityChanging
Gets or sets the event callback that is raised when the grid's column visibility is changing.
Declaration
public EventCallback<ColumnVisibilityChangingEventArgs> ColumnVisibilityChanging { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ColumnVisibilityChangingEventArgs> | An event callback function. |
Remarks
The event handler receives a ColumnVisibilityChangingEventArgs object, which provides details about the columns and the action performed (show or hide) in the grid.
Examples
This example shows how to handle the ColumnVisibilityChanging event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" ColumnVisibilityChanging ="ColumnVisibilityChangingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task ColumnVisibilityChangingHandler(ColumnVisibilityChangingEventArgs args)
{
var vivibleColumns = args.VisibleColumns; // To get the visible columns list
}
CommandClicked
Gets or sets an event callback that is raised after command column button is clicked in the grid.
Declaration
public EventCallback<CommandClickEventArgs<TValue>> CommandClicked { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<CommandClickEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a CommandClickEventArgs<T> object, which contains corresponding command column and row details. With this event handler, you can perform a custom action based on the row and command column details. You can prevent the action by setting Cancel as true.
Examples
<SfGrid DataSource="@Orders" AllowGrouping="true" AllowFiltering="true" AllowPaging="true" ShowColumnMenu="true">
<GridEvents CommandClicked="OnCommandClicked" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void OnCommandClicked(CommandClickEventArgs<Order> args)
{
}
}
ContextMenuItemClicked
Gets or sets an event callback that is raised after clicking an item in context menu of grid. To enable the context menu, you can define either default or custom items in the ContextMenuItems property.
Declaration
public EventCallback<ContextMenuClickEventArgs<TValue>> ContextMenuItemClicked { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ContextMenuClickEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a ContextMenuClickEventArgs<T> object, which contains details about the corresponding menu item, column, and row information. You can perform custom actions for context menu items within this event handler.
Examples
<SfGrid ContextMenuItems="@(new List<object>() { "AutoFit", "AutoFitAll", "SortAscending", "SortDescending","Copy", "Edit",
"Delete", "Save", "Cancel","PdfExport", "ExcelExport", "CsvExport", "FirstPage", "PrevPage","LastPage", "NextPage"})" >
<GridEvents ContextMenuItemClicked="ContextMenuItemClickedHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void ContextMenuItemClickedHandler(ContextMenuClickEventArgs args)
{
}
}
ContextMenuOpen
Gets or sets an event callback that is raised before the context menu is opened by right-clicking anywhere on the grid. The context menu items displayed will depend on the target of the right-click performs in the grid like "header", "content" or "pager".
Declaration
public EventCallback<ContextMenuOpenEventArgs<TValue>> ContextMenuOpen { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ContextMenuOpenEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a ContextMenuOpenEventArgs<T> object, which contains context menu instance so you can customize the context menu item property, within this event handler. If you want to prevent the default action, you can set the Cancel property as true.
Examples
<SfGrid ContextMenuItems="@(new List<object>() { "AutoFit", "AutoFitAll", "SortAscending", "SortDescending","Copy", "Edit",
"Delete", "Save", "Cancel","PdfExport", "ExcelExport", "CsvExport", "FirstPage", "PrevPage","LastPage", "NextPage"})" >
<GridEvents ContextMenuOpen="ContextMenuOpenHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void ContextMenuOpenHandler(ContextMenuOpenEventArgs<Order> args)
{
}
}
Created
An event that is raised when the component is created. Event can be used to perform any necessary initialization logic before the component is rendered.
Declaration
public EventCallback<object> Created { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> | An event callback function. |
Examples
<SfGrid>
<GridEvents Created="CreatedHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void CreatedHandler()
{
}
}
DataBound
Gets or sets an event callback that is raised after a grid component finished rendering. This event can be used to perform any custom logic after data is populated in grid component.
Declaration
public EventCallback<object> DataBound { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> | An event callback function. |
Remarks
This event is invoked after the OnDataBound event.
Examples
<SfGrid>
<GridEvents DataBound="DataBoundHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void DataBoundHandler()
{
}
}
Destroyed
Gets or sets an event callback that is raised when the grid component is destroyed. This can happen when the component is removed from the DOM or when the page is refreshed.
Declaration
public EventCallback<object> Destroyed { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> | An event callback function. |
Examples
<SfGrid>
<GridEvents Destroyed="DestroyHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void DestroyHandler()
{
}
}
DetailDataBound
Get or set an event callback that is raised when a detail row is expanded. The purpose of this event is to bind values or data to the detail template element that will be used to render the contents of the detail row.
Declaration
public EventCallback<DetailDataBoundEventArgs<TValue>> DetailDataBound { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<DetailDataBoundEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a DetailDataBoundEventArgs<T> object that provides details about the selected row. Based on the selected row information, perform any action and display any template element within the detailed row of grid.
Examples
<SfGrid>
<GridEvents DetailDataBound="DetailDataBoundHandler" TValue="Employee"></GridEvents>
</SfGrid>
@code {
public void DetailDataBoundHandler(DetailDataBoundEventArgs<Employee> args)
{
}
}
DetailsCollapsed
Gets or sets an event callback that is raised after the detail template row is collapsed by click on the expanded icon in the grid or programmatically collapsed the detail row.
Declaration
public EventCallback<DetailsCollapsedEventArgs<TValue>> DetailsCollapsed { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<DetailsCollapsedEventArgs<TValue>> | An event callback function. |
Examples
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" DetailsCollapsed="DetailsCollapsed"></GridEvents>
........
</SfGrid>
@code{
public async Task DetailsCollapsed(DetailsCollapsedEventArgs<Orders> args)
{
...........
}
DetailsCollapsing
Gets or sets an event callback that is raised when the detail template row is collapsing by click on the expanded icon in the grid or programmatically collapsed the detail row.
Declaration
public EventCallback<DetailsCollapsingEventArgs<TValue>> DetailsCollapsing { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<DetailsCollapsingEventArgs<TValue>> | An event callback function. |
Remarks
You can prevent collapse action using
Examples
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" DetailsCollapsing="DetailsCollapse"></GridEvents>
........
</SfGrid>
@code{
public async Task DetailsCollapse(DetailsCollapsingEventArgs<Orders> args)
{
args.Cancel = true;
}
DetailsExpanded
Gets or sets an event callback that is raised after a detail row is expanded by click on the collapsed icon of the corresponding row or programmatically expanding the detail row to display the detail template content.
Declaration
public EventCallback<DetailsExpandedEventArgs<TValue>> DetailsExpanded { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<DetailsExpandedEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a DetailsExpandedEventArgs<T> object which provides the details of the expanded detail row.
Examples
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" DetailsExpanded="DetailsExpanded"></GridEvents>
........
</SfGrid>
@code{
public async Task DetailsExpanded(DetailsExpandedEventArgs<Orders> args)
{
...........
}
DetailsExpanding
Gets or sets an event callback that is raised when detail row is expanding by click on the collapsed icon of the corresponding row or programmatically expanding the detail row.
Declaration
public EventCallback<DetailsExpandingEventArgs<TValue>> DetailsExpanding { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<DetailsExpandingEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a DetailsExpandingEventArgs<T> object which provides details about the expanding row. You can prevent the expand action using the Cancel property.
Examples
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" DetailsExpanding="DetailsExpand"></GridEvents>
........
</SfGrid>
@code{
public async Task DetailsExpand(DetailsExpandingEventArgs<Orders> args)
{
args.Cancel = true;
}
EditCanceled
Gets or sets the event callback that is invoked after the cancel action is performed in the grid, specifically when using Normal and Dialog edit modes.
Declaration
public EventCallback<EditCanceledEventArgs<TValue>> EditCanceled { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<EditCanceledEventArgs<TValue>> | An event callback function. |
Remarks
The event handler receives a EditCanceledEventArgs<T> object, which provides details about the after cancel action in the grid.
Examples
This example shows how to handle the EditCanceled event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" EditCanceled ="CanceledHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task CanceledHandler(EditCanceledEventArgs<Order> args)
{
var data = args.Data; // Gets the data of the Canceled record.
}
EditCanceling
Gets or sets the event callback that is invoked before the cancel action is performed in the grid, specifically when using Normal and Dialog edit modes.
Declaration
public EventCallback<EditCancelingEventArgs<TValue>> EditCanceling { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<EditCancelingEventArgs<TValue>> | An event callback function. |
Remarks
The event handler receives a EditCancelingEventArgs<T> object, which provides details about the before cancel action in the grid.
Examples
This example shows how to handle the EditCanceling event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" EditCanceling ="CancelingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task CancelingHandler(EditCancelingEventArgs<Order> args)
{
if(args.PreviousData.OrderID == 10248)
{
args.Cancel = true; // To cancel the cancel action for a specific record.
}
}
ExcelAggregateTemplateInfo
Gets or sets an event callback that is raised whenever a caption, footer, or group footer aggregate row is created on the excel sheet. This event is triggered when the user clicks on the Excel exporting icon in the toolbar.
Declaration
public Action<ExcelAggregateEventArgs> ExcelAggregateTemplateInfo { get; set; }
Property Value
Type | Description |
---|---|
System.Action<ExcelAggregateEventArgs> | An event callback function. |
Remarks
Within this event handler, you can customize the appearance and contents of caption, footer, or group footer aggregate rows in the exported Excel file.
Examples
<SfGrid>
<GridEvents ExcelAggregateTemplateInfo="ExcelAggregateTemplateInfoHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "Excel Export")
{
await this.Grid.ExcelExport();
}
}
public void ExcelAggregateTemplateInfoHandler(ExcelAggregateEventArgs args)
{
}
}
ExcelDetailTemplateExporting
Gets or sets an event callback that is raised before a detail template is appended to an Excel sheet.
Declaration
public Action<ExcelDetailTemplateEventArgs<TValue>> ExcelDetailTemplateExporting { get; set; }
Property Value
Type | Description |
---|---|
System.Action<ExcelDetailTemplateEventArgs<TValue>> | An event callback function. |
Remarks
This event will be triggered only when the ExcelDetailRowMode is set to Expand
or Collapse
in ExcelExportProperties.
This event handler receives a ExcelDetailTemplateEventArgs<T> object, which provides details about the corresponding parent row along with additional customization options for the Excel detail template.
Within this event handler, you can customize the appearance and content of the exported Excel file before a detail template added. Additionally, this event supports achieving nested grid exporting.
Examples
<SfGrid>
<GridEvents ExcelDetailTemplateExporting="ExcelDetailTemplateEventHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "Excel Export")
{
ExcelExportProperties ExportProperties = new ExcelExportProperties();
ExportProperties.ExcelDetailRowMode = ExcelDetailRowMode.Expand;
await this.Grid.ExcelExport(ExportProperties);
}
}
public void ExcelDetailTemplateEventHandler(ExcelDetailTemplateEventArgs<Order> args)
{
. . . .
}
}
ExcelGroupCaptionTemplateInfo
Gets or sets an event callback that is raised whenever a group caption template is created on the excel sheet. This event is triggered when the user clicks on the Excel exporting icon in the toolbar.
Declaration
public Action<ExcelCaptionTemplateArgs> ExcelGroupCaptionTemplateInfo { get; set; }
Property Value
Type | Description |
---|---|
System.Action<ExcelCaptionTemplateArgs> | An event callback function. |
Remarks
Within this event handler, you can customize the appearance and contents of group caption templates in the exported Excel file.
Examples
<SfGrid>
<GridEvents ExcelGroupCaptionTemplateInfo="ExcelGroupCaptionHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "Excel Export")
{
await this.Grid.ExcelExport();
}
}
public void ExcelGroupCaptionHandler(ExcelCaptionTemplateArgs Args)
{
}
}
ExcelHeaderQueryCellInfoEvent
Gets or sets an event callback that is raised whenever a data entered into a header cell of the excel sheet. This event is triggered when the user clicks on the Excel exporting icon in the toolbar.
Declaration
public Action<ExcelHeaderQueryCellInfoEventArgs> ExcelHeaderQueryCellInfoEvent { get; set; }
Property Value
Type | Description |
---|---|
System.Action<ExcelHeaderQueryCellInfoEventArgs> | An event callback function. |
Remarks
Within this event handler, you can customize the appearance and contents of individual header cells in the exported Excel file.
Examples
<SfGrid>
<GridEvents ExcelHeaderQueryCellInfoEvent="ExcelHeaderQueryCellInfoHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "Excel Export")
{
await this.Grid.ExcelExport();
}
}
public void ExcelHeaderQueryCellInfoHandler(ExcelHeaderQueryCellInfoEventArgs<Order> args)
{
}
}
ExcelQueryCellInfoEvent
Gets or sets an event callback that is raised whenever a data is entered into a cell of the Excel sheet. This event is triggered when the user clicks on the Excel exporting icon in the toolbar.
Declaration
public Action<ExcelQueryCellInfoEventArgs<TValue>> ExcelQueryCellInfoEvent { get; set; }
Property Value
Type | Description |
---|---|
System.Action<ExcelQueryCellInfoEventArgs<TValue>> | An event callback function. |
Remarks
Within this event handler, you can customize the appearance and contents of individual data cells in the exported Excel file.
Examples
<SfGrid>
<GridEvents ExcelQueryCellInfoEvent="ExcelQueryCellInfoHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "Excel Export")
{
await this.Grid.ExcelExport();
}
}
public void ExcelQueryCellInfoHandler(ExcelQueryCellInfoEventArgs<Order> args)
{
}
}
ExportComplete
Gets or sets an event callback that is raised when the export process is completed.
Declaration
public Action<object> ExportComplete { get; set; }
Property Value
Type | Description |
---|---|
System.Action<System.Object> | An event callback function. |
Examples
<SfGrid>
<GridEvents ExportComplete="ExportCompleteHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "Excel Export")
{
await this.Grid.ExcelExport();
}
}
public void ExportCompleteHandler(object args)
{
}
}
FilterDialogOpened
Gets or sets the event callback that is raised after the filter dialog is opened in the grid.
Declaration
public EventCallback<FilterDialogOpenedEventArgs> FilterDialogOpened { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<FilterDialogOpenedEventArgs> | An event callback function. |
Remarks
The event handler receives a FilterDialogOpenedEventArgs object, which provides details about the filter dialog opened in the grid.
Examples
This example shows how to handle the FilterDialogOpened event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" FilterDialogOpened="FilterDialogOpenedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task FilterDialogOpenedHandler(FilterDialogOpenedEventArgs args)
{
}
FilterDialogOpening
Gets or sets the event callback that is raised before the filter dialog is opened in the grid.
Declaration
public EventCallback<FilterDialogOpeningEventArgs> FilterDialogOpening { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<FilterDialogOpeningEventArgs> | An event callback function. |
Remarks
The event handler receives a FilterDialogOpeningEventArgs object, which provides details about the filter dialog opening in the grid.
Examples
This example shows how to handle the FilterDialogOpening event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" FilterDialogOpening ="FilterDialogOpeningHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task FilterDialogOpeningHandler(FilterDialogOpeningEventArgs args)
{
args.Cancel = true; // To cancel the filter dialog opening action.
}
Filtered
Gets or sets the event callback that is raised after the filtered or clear filtered action is performed in the grid.
Declaration
public EventCallback<FilteredEventArgs> Filtered { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<FilteredEventArgs> | An event callback function. |
Remarks
The event handler receives a FilteredEventArgs object, which contains details about filtering or clearing the filtering action in the grid.
Examples
This example shows how to handle the Filtered event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" Filtered ="FilteredHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task FilteredHandler(FilteredEventArgs args)
{
}
Filtering
Gets or sets the event callback that is raised before the filtering or clear filtering action is performed in the grid.
Declaration
public EventCallback<FilteringEventArgs> Filtering { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<FilteringEventArgs> | An event callback function. |
Remarks
The event handler receives a FilteringEventArgs object, which contains details about filtering or clearing the filtering action in the grid.
Examples
This example shows how to handle the Filtering event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" Filtering="FilteringHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task FilteringHandler(FilteringEventArgs args)
{
}
FreezeLineMoved
Gets or sets an event callback that is raised after moved freeze line.
Declaration
public EventCallback<FreezeLineMovedEventArgs> FreezeLineMoved { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<FreezeLineMovedEventArgs> | An event callback function. |
Remarks
This event handler receives a FreezeLineMovedEventArgs object which provides frozen columns details.
Examples
<SfGrid DataSource="@Orders">
<GridEvents FreezeLineMoved="FreezeLineMovedHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void FreezeLineMovedHandler(FreezeLineMoving args)
{
}
}
FreezeLineMoving
Gets or sets an event callback that is raised on moving freeze line.
Declaration
public EventCallback<FreezeLineMovingEventArgs> FreezeLineMoving { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<FreezeLineMovingEventArgs> | An event callback function. |
Remarks
You can prevent the freeze action using Cancel.
Examples
<SfGrid DataSource="@Orders">
<GridEvents FreezeLineMoving="FreezeLineMovingHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void FreezeLineMovingHandler(FreezeLineMoving args)
{
args.Cancel = true;
}
}
Grouped
Gets or sets the event callback that is raised after grouping or ungrouping action is performed in the grid.
Declaration
public EventCallback<GroupedEventArgs> Grouped { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<GroupedEventArgs> | An event callback function. |
Remarks
The event handler receives a GroupedEventArgs object, which provides details about the after grouping or ungrouping action in the grid.
Examples
This example shows how to handle the Grouped event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" Grouped="GroupedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task GroupedHandler(GroupedEventArgs args)
{
var groupedColumns = args.ColumnName; // Gets the grouped columns.
}
Grouping
Gets or sets the event callback that is raised after grouping action or un-grouping action is performed in the grid.
Declaration
public EventCallback<GroupingEventArgs> Grouping { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<GroupingEventArgs> | An event callback function. |
Remarks
The event handler receives a GroupingEventArgs object, which provides details about the before grouping action or un-grouping action in the grid.
Examples
This example shows how to handle the Grouping event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" Grouping="GroupingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task GroupingHandler(GroupingEventArgs args)
{
args.Cancel = true; // To cancel the grouping action.
}
HeaderCellInfo
Gets or sets an event callback that is raised before a request is made to access the grid header cell information.
Declaration
public EventCallback<HeaderCellInfoEventArgs> HeaderCellInfo { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<HeaderCellInfoEventArgs> | An event callback function. |
Remarks
This event handler receives a HeaderCellInfo object which provides the details of header cells. This event allows you to customize the header cells by adding classes, changing their header text, etc...
Examples
The following example demonstrates how to handle the HeaderCellInfo event to customize the header cells.
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" HeaderCellInfo="HeaderCell"></GridEvents>
........
</SfGrid>
@code{
public async Task HeaderCell(HeaderCellInfoEventArgs args)
{
if (args.Column.Field == "OrderID")
{
// You can customize the header cell.
args.Cell.AddClass(new string[] { "newclass" });
}
}
}
OnActionBegin
Gets or sets an event callback that is raised when the grid actions such as sorting, paging, grouping, ungrouping, reorder, rowdraganddrop, filtering, add, edit, delete, save and cancel action begins.
Declaration
public EventCallback<ActionEventArgs<TValue>> OnActionBegin { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ActionEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a ActionEventArgs<T> object which provides the details of the current grid action.
You can differentiate the actions using
Examples
<SfGrid DataSource="@Orders">
<GridEvents OnActionBegin="ActionBeginHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void ActionBeginHandler(ActionEventArgs<Order> args)
{
args.Cancel = true;
}
}
OnActionComplete
Gets or sets an event callback that is raised when the grid actions such as sorting, paging, grouping, ungrouping, reorder, rowdraganddrop, filtering, add, edit, delete, save and cancel action completed.
Declaration
public EventCallback<ActionEventArgs<TValue>> OnActionComplete { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ActionEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a ActionEventArgs<T> object that provides details of the current grid action. An event triggered after the grid action has completed so you cannot prevent the current grid action using Cancel.
Examples
<SfGrid DataSource="@Orders">
<GridEvents OnActionComplete="ActionCompletedHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void ActionCompletedHandler(ActionEventArgs<Order> args)
{
}
}
OnActionFailure
Gets or sets the event callback that is raised when a grid action fails to achieve the desired results. For example, if the provided URL in the dataSource property is incorrect, it will throw an exception in the OnActionFailure event.
Declaration
public EventCallback<FailureEventArgs> OnActionFailure { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<FailureEventArgs> | An event callback function. |
Remarks
This event handler receives a FailureEventArgs object that provides details of the error in the grid, including a stack trace of any exceptions that occurred.
Examples
<SfGrid DataSource="@Orders">
<GridEvents OnActionFailure="ActionFailureHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void ActionFailureHandler(FailureEventArgs args)
{
}
}
OnBatchAdd
Gets or sets an event callback that is raised before new records are added to the UI when a user clicks the add toolbar item or presses the insert key.
Declaration
public EventCallback<BeforeBatchAddArgs<TValue>> OnBatchAdd { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeBatchAddArgs<TValue>> | An event callback function. |
Remarks
This event will be raised only for Batch mode.
This event handler receives a
Examples
<SfGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<GridEvents OnBatchAdd="BatchAddHandler" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
</SfGrid>
@code {
public void BatchAddHandler(BeforeBatchAddArgs<Order> args)
{
args.Cancel = true;
}
}
OnBatchCancel
Gets or sets an event callback that is raised before batch changes are canceled from the grid element. The edited cell will be highlighted in the grid and it will be removed and returned to its original state after canceling the batch action. When the Cancel button on the toolbar is clicked, a confirmation popup is displayed to confirm the cancel action to be performed in the grid.
Declaration
public EventCallback<BeforeBatchCancelArgs<TValue>> OnBatchCancel { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeBatchCancelArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a
Examples
<SfGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<GridEvents OnBatchCancel="BatchcancelHandler" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
</SfGrid>
@code {
public void BatchcancelHandler(BeforeBatchCancelArgs<Order> args)
{
args.Cancel = true;
}
}
OnBatchDelete
Gets or sets an event callback that is raised before records are deleted in the grid element. You can perform delete action by click delete toolbar item or pressing the delete key. If no rows have been selected for deletion, a popup will be displayed allowing the user to select the rows they wish to delete before the operation is performed.
Declaration
public EventCallback<BeforeBatchDeleteArgs<TValue>> OnBatchDelete { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeBatchDeleteArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a
Examples
<SfGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<GridEvents OnBatchDelete="BatchDeleteHandler" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
</SfGrid>
@code {
public void BatchDeleteHandler(BeforeBatchDeleteArgs<Order> args)
{
args.Cancel = true;
}
}
OnBatchSave
Gets or sets an event callback that is raised before batch changes(such as added, edited and deleted data) are saved in dataSource. The edited data can be saved by clicking the
Declaration
public EventCallback<BeforeBatchSaveArgs<TValue>> OnBatchSave { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeBatchSaveArgs<TValue>> | An event callback function. |
Remarks
The
Examples
<SfGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<GridEvents OnBatchSave="BatchSaveHandler" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
</SfGrid>
@code {
public void BatchSaveHandler(BeforeBatchSaveArgs<Order> args)
{
args.Cancel = true;
}
}
OnBeginEdit
Gets or sets the event callback that is raised before a row enters edit mode in the UI, such as when a user double-clicks a cell or presses F2 / edit toolbar item to enter edit mode.
Declaration
public EventCallback<BeginEditArgs<TValue>> OnBeginEdit { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeginEditArgs<TValue>> | An event callback function. |
Remarks
This event is raised when EditMode as Normal or Dialog. This event handler receives a BeginEditArgs<T> object, that contains information about the record being edited. This allows you to customize the data before it enters into edit mode. You can prevent the edit action by setting Cancel to true.
Examples
<SfGrid DataSource="@Orders">
<GridEvents OnBeginEdit="BeginEditHandler" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Normal"></GridEditSettings>
</SfGrid>
@code {
public void BeginEditHandler(BeginEditArgs<Order> args)
{
args.Cancel = true;
}
}
OnCellEdit
Gets or sets the event callback that is raised before a cell enters edit mode in the UI, such as when a user double-clicks a cell or presses F2 to enter edit mode.
Declaration
public EventCallback<CellEditArgs<TValue>> OnCellEdit { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<CellEditArgs<TValue>> | An event callback function. |
Remarks
This event is raised when Batch as Batch.
Use this event to prevent the edit action by setting
Examples
<SfGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<GridEvents OnCellEdit="CellEditHandler" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
</SfGrid>
@code {
public void CellEditHandler(CellEditArgs<Order> args)
{
args.Cancel = true;
}
}
OnCellSave
Gets or sets an event callback that is raised before cell changes are updated in the UI. The save action will happen when the cell is in edit state and the user performs an action such as pressing Enter key, clicking or navigating to a new cell.
Declaration
public EventCallback<CellSaveArgs<TValue>> OnCellSave { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<CellSaveArgs<TValue>> | An event callback function. |
Remarks
Within this event handler, you can customize the edited value before update it in grid UI.
You can prevent the save action using
Examples
<SfGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<GridEvents OnCellSave="CellSaveHandler" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
</SfGrid>
@code {
public void CellSaveHandler(CellSaveArgs<Order> args)
{
args.Cancel = true;
}
}
OnColumnMenuOpen
Gets or sets an event callback that is raised when the column menu is opened by clicking the column menu icon in the grid column. This event is also triggered when opening sub-menu items within the column menu.
Declaration
public EventCallback<ColumnMenuOpenEventArgs> OnColumnMenuOpen { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ColumnMenuOpenEventArgs> | An event callback function. |
Remarks
This event handler receives a ColumnMenuOpenEventArgs object, which contains the column menu instance. You can customize the column menu item properties within this event handler. To prevent the default action, set the Cancel property to true.
Examples
<SfGrid DataSource="@Orders" AllowGrouping="true" AllowFiltering="true" AllowPaging="true" ShowColumnMenu="true">
<GridEvents OnColumnMenuOpen ="ColumnMenuOpenHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void ColumnMenuOpenHandler(ColumnMenuOpenEventArgs args)
{
args.Cancel = true; // Prevents the column menu from opening
}
}
OnDataBound
Gets or sets an event callback that is raised before data is bound to the grid, allowing you to customize the current view data in this event handler.
Declaration
public EventCallback<BeforeDataBoundArgs<TValue>> OnDataBound { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeDataBoundArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a BeforeDataBoundArgs<T> object, which contains current view data and total records count.
Examples
<SfGrid DataSource="@Orders">
<GridEvents OnDataBound="DataBoundHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void void DataBoundHandler(BeforeDataBoundArgs<Order> args)
{
}
}
OnExcelExport
Gets or sets an event callback that is raised before the grid data is exported to an Excel/CSV file. This event is triggered when the user clicks on the Excel exporting icon in the toolbar.
Declaration
public Action<object> OnExcelExport { get; set; }
Property Value
Type | Description |
---|---|
System.Action<System.Object> | An event callback function. |
Examples
<SfGrid>
<GridEvents OnExcelExport="ExcelExportHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "Excel Export")
{
await this.Grid.ExcelExport();
}
}
public void ExcelExportHandler(object args)
{
}
}
OnLoad
Gets or sets an event callback that is raised before rendering of the grid, and it provides a callback method that you can use to customize the grid properties.
Declaration
public EventCallback<object> OnLoad { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> | An event callback function. |
Examples
<SfGrid>
<GridEvents TValue="Orders" OnLoad="LoadHandler"></GridEvents>
</SfGrid>
@code {
public void LoadHandler(object args)
{
}
}
OnPdfExport
Gets or sets an event callback that is raised just before the grid is exported to a PDF document. This event is triggered when the user clicks on the PDF exporting icon in the toolbar.
Declaration
public Action<object> OnPdfExport { get; set; }
Property Value
Type | Description |
---|---|
System.Action<System.Object> | An event callback function. |
Examples
<SfGrid>
<GridEvents OnPdfExport="PdfExportHandler" OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "PDF Export")
{
await this.Grid.PdfExport();
}
}
public void PdfExportHandler(object args)
{
}
}
OnRecordClick
Gets or sets an event callback that is raised when a cell is clicked in the grid.
Declaration
public EventCallback<RecordClickEventArgs<TValue>> OnRecordClick { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RecordClickEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a RecordClickEventArgs<T> object, which provides the information about the clicked cell and row information.
Examples
<SfGrid>
<GridEvents OnRecordClick="RecordClickHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void RecordClickHandler(RecordClickEventArgs<Order> args)
{
}
}
OnRecordDoubleClick
Gets or sets an event callback that is raised when a cell is double clicked in grid.
Declaration
public EventCallback<RecordDoubleClickEventArgs<TValue>> OnRecordDoubleClick { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RecordDoubleClickEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a RecordDoubleClickEventArgs<T> object, which provides the information about the clicked cell and row information.
Examples
<SfGrid>
<GridEvents OnRecordDoubleClick="RecordDoubleClickHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void RecordDoubleClickHandler(RecordDoubleClickEventArgs<Order> args)
{
}
}
OnResizeStart
Gets or sets an event callback that is raised when column resizing is starts.
Declaration
public EventCallback<ResizeArgs> OnResizeStart { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ResizeArgs> | An event callback function. |
Remarks
This event handler receives a ResizeArgs object which provides the details of the resizing column. You can prevent the resize action using Cancel.
Examples
<SfGrid>
<GridEvents OnResizeStart="OnResizeStartHanlder" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void OnResizeStartHanlder(ResizeArgs args)
{
args.Cancel = true;
}
}
OnRowDragStart
Gets or sets an event callback that is raised when we start dragging the rows to perform row reordering.
Declaration
public EventCallback<RowDragEventArgs<TValue>> OnRowDragStart { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowDragEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a RowDragEventArgs<T> object which provides the details of the rows from which it is dragged.
Examples
<SfGrid DataSource="@Orders">
<GridEvents TValue="Orders" OnRowDragStart="OnRowDragStartHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task OnRowDragStartHandler(RowDragEventArgs<Orders> args)
{
//you can get the dragged row data's here
List<Orders> Data = args.Data;
}
OnRowEditStart
Gets or sets the event callback that is raised before an editing action is performed in the grid.
This event is primarily used to enable or disable the PreventDataClone
argument, which controls
whether the Data
argument belonging to the RowEditing event will be cloned or not.
Declaration
public EventCallback<OnRowEditStartEventArgs> OnRowEditStart { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<OnRowEditStartEventArgs> | An event callback function. |
Remarks
The event handler receives a OnRowEditStartEventArgs object, which provides details about the before the edit action in the grid.
Examples
This example shows how to handle the OnRowEditStart event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" OnRowEditStart ="BeforeRowEditingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task BeforeRowEditingHandler(OnRowEditStartEventArgs<Order> args)
{
args.PreventDataClone = true; // To prevent the data from being cloned.
}
OnToolbarClick
Gets or sets an event callback that is raised when a toolbar item is clicked or the Enter key is pressed after focusing on the toolbar item.
Declaration
public EventCallback<ClickEventArgs> OnToolbarClick { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ClickEventArgs> | An event callback function. |
Remarks
This event handler receives a object which provides the details about the toolbar items. Within this event handler, you can use custom actions for toolbar items.
Examples
<SfGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<GridEvents OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
}
}
PageChanged
Gets or sets the event callback that is raised after paging action is performed in the grid.
Declaration
public EventCallback<GridPageChangedEventArgs> PageChanged { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<GridPageChangedEventArgs> | An event callback function. |
Remarks
The event handler receives a GridPageChangedEventArgs object, which provides details about the after paging action in the grid.
Examples
This example shows how to handle the PageChanged event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" PageChanged="PageChangedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task PageChangedHandler (GridPageChangedEventArgs args)
{
int pagenumber = args.CurrentPage; // Gets the current page number.
}
PageChanging
Gets or sets the event callback that is raised before paging action is performed in the grid.
Declaration
public EventCallback<GridPageChangingEventArgs> PageChanging { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<GridPageChangingEventArgs> | An event callback function. |
Remarks
The event handler receives a GridPageChangingEventArgs object, which provides details about the before paging action in the grid.
Examples
This example shows how to handle the PageChanging event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" PageChanging="PageChangingHandler"></GridEvents>
........
</SfGrid>
@code {
public async Task PageChangingHandler (GridPageChangingEventArgs args)
{
args.CurrentPage = 2; // Sets the current page number.
}
Parent
Declaration
protected SfGrid<TValue> Parent { get; set; }
Property Value
Type |
---|
SfGrid<TValue> |
PdfAggregateTemplateInfo
Gets or sets an event callback that is raised whenever a caption, footer, or group footer aggregate row is created on the PDF document. This event is triggered when the user clicks on the PDF exporting icon in the toolbar.
Declaration
public Action<PdfAggregateEventArgs> PdfAggregateTemplateInfo { get; set; }
Property Value
Type | Description |
---|---|
System.Action<PdfAggregateEventArgs> | An event callback function. |
Remarks
Within this event handler, you can customize the appearance and contents of caption, footer, or group footer aggregate rows in the exported PDF document.
Examples
<SfGrid AllowPdfExport="true" Toolbar="@(new List<string>() { "PdfExport" })">
<GridEvents PdfAggregateTemplateInfo="PdfAggregateTemplateInfoHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "PDF Export")
{
await this.Grid.PdfExport();
}
}
public void PdfAggregateTemplateInfoHandler(PdfAggregateEventArgs<Order> args)
{
}
}
PdfDetailTemplateExporting
Gets or sets an event callback that is raised before a detail template is append to Pdf file format.
Declaration
public Action<PdfDetailTemplateEventArgs<TValue>> PdfDetailTemplateExporting { get; set; }
Property Value
Type | Description |
---|---|
System.Action<PdfDetailTemplateEventArgs<TValue>> | An event callback function. |
Remarks
This event will be triggered only when the PdfDetailRowMode
is set to Expand
in PdfExportProperties.
This event handler receives a PdfDetailTemplateEventArgs<T> object, which provides details about the corresponding parent row, along with additional customization options for the PDF detail template.
Within this event handler, you can customize the appearance and content of the PDF document before a detail template added. Additionally, this event supports achieving nested grid exporting.
Examples
<SfGrid AllowPdfExport="true" Toolbar="@(new List<string>() { "PdfExport" })">
<GridEvents PdfDetailTemplateExporting="PdfDetailTemplateEventHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "PDF Export")
{
await this.Grid.PdfExport();
}
}
public void PdfDetailTemplateEventHandler(PdfDetailTemplateEventArgs<Order> args)
{
}
}
PdfGroupCaptionTemplateInfo
Gets or sets an event callback that is raised whenever a group caption template is created on the PDF document. This event is triggered when the user clicks on the PDF exporting icon in the toolbar.
Declaration
public Action<PdfCaptionTemplateArgs> PdfGroupCaptionTemplateInfo { get; set; }
Property Value
Type | Description |
---|---|
System.Action<PdfCaptionTemplateArgs> | An event callback function. |
Remarks
Within this event handler, you can customize the appearance and contents of group caption templates in the exported PDF document.
Examples
<SfGrid AllowPdfExport="true" Toolbar="@(new List<string>() { "PdfExport" })">
<GridEvents PdfGroupCaptionTemplateInfo="PdfGroupCaptionHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "PDF Export")
{
await this.Grid.PdfExport();
}
}
public void PdfGroupCaptionHandler(PdfCaptionTemplateArgs Args)
{
}
}
PdfHeaderQueryCellInfoEvent
Gets or sets an event callback that is raised whenever grid header cell is exported into PDF document. This event is triggered when the user clicks on the PDF exporting icon in the toolbar.
Declaration
public Action<PdfHeaderQueryCellInfoEventArgs> PdfHeaderQueryCellInfoEvent { get; set; }
Property Value
Type | Description |
---|---|
System.Action<PdfHeaderQueryCellInfoEventArgs> | An event callback function. |
Remarks
This event handler receives a PdfHeaderQueryCellInfoEventArgs object, which provides corresponding column and cell informations. Within this event handler, you can customize the appearance and contents of individual header cells in the exported PDF document.
Examples
<SfGrid AllowPdfExport="true" Toolbar="@(new List<string>() { "PdfExport" })">
<GridEvents PdfHeaderQueryCellInfoEvent="PdfHeaderQueryCellInfoHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "PDF Export")
{
await this.Grid.PdfExport();
}
}
public void PdfHeaderQueryCellInfoHandler(PdfHeaderQueryCellInfoEventArgs args)
{
}
}
PdfQueryCellInfoEvent
Gets or sets an event callback that is raised whenever a grid data cell is exported into PDF document. This event is triggered when the user clicks on the PDF exporting icon in the toolbar.
Declaration
public Action<PdfQueryCellInfoEventArgs<TValue>> PdfQueryCellInfoEvent { get; set; }
Property Value
Type | Description |
---|---|
System.Action<PdfQueryCellInfoEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a PdfQueryCellInfoEventArgs<T> object, which provides corresponding row and cell informations. Within this event handler, you can customize the appearance and contents of individual data cells in the exported PDF document.
Examples
<SfGrid AllowPdfExport="true" Toolbar="@(new List<string>() { "PdfExport" })">
<GridEvents PdfQueryCellInfoEvent="PdfQueryCellInfoHandler" OnToolbarClick="ToolbarClickHandler" TValue="BusinessObject"></GridEvents>
</SfGrid>
@code {
SfGrid<BusinessObject> Grid;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs Args)
{
if (Args.Item.Text == "PDF Export")
{
await this.Grid.PdfExport();
}
}
public void PdfQueryCellInfoHandler(PdfQueryCellInfoEventArgs<BusinessObject> args)
{
}
}
QueryCellInfo
Gets or sets an event callback that is raised before the cell element is appended to the grid element. And the event is raised whenever a grid cell is rendered or refreshed.
Declaration
public EventCallback<QueryCellInfoEventArgs<TValue>> QueryCellInfo { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<QueryCellInfoEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a QueryCellInfoEventArgs<T> object, which provides grid row and cell details. Within this event handler, you can customize the cell element.
Examples
<SfGrid>
<GridEvents QueryCellInfo="QueryCellInfoHandler" TValue="Orders"></GridEvents>
</SfGrid>
@code {
public void QueryCellInfoHandler(QueryCellInfoEventArgs<Orders> args)
{
}
}
ResizeStopped
Gets or sets an event callback that is raised when the column resizing is ends.
Declaration
public EventCallback<ResizeArgs> ResizeStopped { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ResizeArgs> | An event callback function. |
Remarks
This event handler receives a ResizeArgs object which provides the details of the resized column. You can prevent the resize action using Cancel.
Examples
<SfGrid>
<GridEvents ResizeStopped="ResizeStoppedHanlder" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void ResizeStoppedHanlder(ResizeArgs args)
{
args.Cancel = true;
}
}
RowCreated
Gets or sets the event callback that is raised after the add action is performed in the grid.
Declaration
public EventCallback<RowCreatedEventArgs<TValue>> RowCreated { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowCreatedEventArgs<TValue>> | An event callback function. |
Remarks
The event handler receives a RowCreatedEventArgs<T> object, which provides details about the after add action in the grid.
Examples
This example shows how to handle the RowCreated event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" RowCreated ="RowCreatedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowCreatedHandler (RowCreatedEventArgs<Order> args)
{
var addedRecord = args.Data; // Gets the added record.
}
RowCreating
Gets or sets the event callback that is raised before the add action is performed in the grid.
Declaration
public EventCallback<RowCreatingEventArgs<TValue>> RowCreating { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowCreatingEventArgs<TValue>> | An event callback function. |
Remarks
The event handler receives a RowCreatingEventArgs<T> object, which provides details about the before add action in the grid.
Examples
This example shows how to handle the RowCreating event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" RowCreating ="RowAddingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowAddingHandler (RowCreatingEventArgs<Order> args)
{
args.Cancel = true; // To cancel the add action.
}
RowDataBound
Gets or sets an event callback that is raised whenever a request is made to access row information, element, or data. This will be triggered before the row element is appended to the grid.
Declaration
public EventCallback<RowDataBoundEventArgs<TValue>> RowDataBound { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowDataBoundEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a RowDataBoundEventArgs<T> object, which provides information about the corresponding row.
Examples
<SfGrid>
<GridEvents RowDataBound="RowDataBoundHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void RowDataBoundHandler(RowDataBoundEventArgs<Order> args)
{
}
}
RowDeleted
Gets or sets the event callback that is raised after the delete action is performed in the grid.
Declaration
public EventCallback<RowDeletedEventArgs<TValue>> RowDeleted { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowDeletedEventArgs<TValue>> | An event callback function. |
Remarks
The event handler receives a RowDeletedEventArgs<T> object, which provides details about the after delete action in the grid.
Examples
This example shows how to handle the RowDeleted event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" RowDeleted ="RowDeletedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowDeletedHandler(RowDeletedEventArgs<Order> args)
{
var rowIndex = args.RowIndex; // Gets the row index of the deleted record.
}
RowDeleting
Gets or sets the event callback that is raised before the delete action is performed in the grid.
Declaration
public EventCallback<RowDeletingEventArgs<TValue>> RowDeleting { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowDeletingEventArgs<TValue>> | An event callback function. |
Remarks
The event handler receives a RowDeletingEventArgs<T> object, which provides details about the before delete action in the grid.
Examples
This example shows how to handle the RowDeleting event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" RowDeleting ="RowDeletingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowDeletingHandler(RowDeletingEventArgs<Order> args)
{
if(args.Data.OrderID == 10248) // To cancel the delete action for a specific record.
{
args.Cancel = true;
}
}
RowDeselected
Gets or sets an event callback that is raised after a selected row is deselected in the grid. When a row is selected in the grid, if the same row is clicked again or if arrow keys are pressed to move to another row, the previously selected row will be deselected.
Declaration
public EventCallback<RowDeselectEventArgs<TValue>> RowDeselected { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowDeselectEventArgs<TValue>> | An event callback function. |
Remarks
This event is raised when SelectionMode as Row or Both.
The deselection of a row is prevented using the RowDeselecting event, then the RowDeselected
event will not be raised.
Examples
<SfGrid DataSource="@Orders">
<GridEvents RowDeselected="RowDeselectHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void RowDeselectHandler(RowDeselectEventArgs<Order> args)
{
}
}
RowDeselecting
Gets or sets an event callback that is raised before any row deselection occurs in the grid. When a row is selected in the grid, if the same row is clicked again or if arrow keys are pressed to move to another row, the previously selected row will be deselected.
Declaration
public EventCallback<RowDeselectEventArgs<TValue>> RowDeselecting { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowDeselectEventArgs<TValue>> | An event callback function. |
Remarks
You can prevent the row deselection by setting Cancel as true.
Examples
<SfGrid DataSource="@Orders">
<GridEvents RowDeselecting="RowDeselectingHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void RowDeselectingHandler(RowDeselectEventArgs<Order> args)
{
args.Cancel = true;
}
}
RowDragStarting
Gets or sets an event callback that is raised when we start dragging the rows to perform row reordering.
Declaration
public EventCallback<RowDragStartingEventArgs<TValue>> RowDragStarting { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowDragStartingEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a RowDragStartingEventArgs<T> object which provides the details of the rows from which it is dragged.
Examples
<SfGrid DataSource="@Orders">
<GridEvents TValue="Orders" RowDragStarting="RowDragStartingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowDragStartingHandler(RowDragStartingEventArgs<Orders> args)
{
//you can get the dragged row data's here
List<Orders> Data = args.Data;
}
RowDropped
Gets or sets an event callback that is raised when row elements are dropped on the target element.
Declaration
public EventCallback<RowDroppedEventArgs<TValue>> RowDropped { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowDroppedEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a RowDroppedEventArgs<T> object which provides the details of the rows which are dropped and the target where the rows are dropped.
Examples
<SfGrid DataSource="@Orders">
<GridEvents TValue="Orders" RowDropped="RowDroppedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowDroppedHandler(RowDroppedEventArgs<Orders> args)
{
//you can get the dropped row data's here
List<Orders> Data = args.Data;
}
RowDropping
Gets or sets an event callback that is raised when the row elements are dropping on the target element. You can cancel the dropping action using this event.
Declaration
public EventCallback<RowDroppingEventArgs<TValue>> RowDropping { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowDroppingEventArgs<TValue>> | An event callback function. |
Remarks
This event handler receives a RowDroppingEventArgs<T> object which provides the details of the rows which are dropping and the target where the rows are dropping.
If the dropping action is prevented using the Cancel
argument, then the RowDropped event doesn't trigger.
Examples
<SfGrid DataSource="@Orders">
<GridEvents TValue="Orders" RowDropping="RowDroppingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowDroppingHandler(RowDroppingEventArgs<Orders> args)
{
//you can cancel the dropping action here
args.Cancel = true;
}
RowEdited
Gets or sets the event callback that is raised after the edit action is performed in the grid.
Declaration
public EventCallback<RowEditedEventArgs<TValue>> RowEdited { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowEditedEventArgs<TValue>> | An event callback function. |
Remarks
The event handler receives a RowEditedEventArgs<T> object, which provides details about the after edit action in the grid.
Examples
This example shows how to handle the RowEdited event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" RowEdited ="RowEditedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowEditedHandler(RowEditedEventArgs<<Order> args)
{
var editedData = args.Data; // Gets the data of the edited record.
}
RowEditing
Gets or sets the event callback that is raised before the edit action is performed in the grid.
Declaration
public EventCallback<RowEditingEventArgs<TValue>> RowEditing { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowEditingEventArgs<TValue>> | An event callback function. |
Remarks
The event handler receives a RowEditingEventArgs<T> object, which provides details about the before edit action in the grid.
Examples
This example shows how to handle the RowEditing event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" RowEditing ="RowEditingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowEditingHandler(RowEditingEventArgs<<Order> args)
{
args.Cancel = true ; // To cancel the editing action
}
RowSelected
Gets or sets an event callback that is raised after a row is selected in the grid. Row selection can be done by click on the row or presssing arrow keys with or wihtout Shift or Ctrl keys or doing drag selection or programmatically.
Declaration
public EventCallback<RowSelectEventArgs<TValue>> RowSelected { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowSelectEventArgs<TValue>> | An event callback function. |
Remarks
This event is raised when SelectionMode as Row or Both.
The selection of a row is prevented using the RowSelecting event, then the RowSelected
event will not be raised.
Examples
<SfGrid DataSource="@Orders">
<GridEvents RowSelected="RowselectHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void RowselectHandler(RowSelectEventArgs<Order> args)
{
}
}
RowSelecting
Gets or sets an event callback that is raised before any row selection occurs in the grid. Row selection can be done by click on the row or presssing arrow keys with or wihtout Shift or Ctrl keys or doing drag selection or programmatically.
Declaration
public EventCallback<RowSelectingEventArgs<TValue>> RowSelecting { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowSelectingEventArgs<TValue>> | An event callback function. |
Remarks
This event is raised when SelectionMode as Row or Both.
You can prevent the cell selection action using
Examples
<SfGrid DataSource="@Orders">
<GridEvents RowSelecting="RowselectingHandler" TValue="Order"></GridEvents>
</SfGrid>
@code {
public void RowselectingHandler(RowSelectingEventArgs<Order> args)
{
args.Cancel = true;
}
}
RowUpdated
Gets or sets the event callback that is raised after the save action is performed in the grid.
Declaration
public EventCallback<RowUpdatedEventArgs<TValue>> RowUpdated { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowUpdatedEventArgs<TValue>> | An event callback function. |
Remarks
The event handler receives a RowUpdatedEventArgs<T> object, which provides details about the after save action in the grid.
Examples
This example shows how to handle the RowUpdated event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" RowUpdated ="RowUpdatedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowUpdatedHandler (RowUpdatedEventArgs<Order> args)
{
var rowIndex = args.Index; // Gets the row index of the saved record.
}
RowUpdating
Gets or sets the event callback that is raised before the save action is performed in the grid.
Declaration
public EventCallback<RowUpdatingEventArgs<TValue>> RowUpdating { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<RowUpdatingEventArgs<TValue>> | An event callback function. |
Remarks
The event handler receives a RowUpdatingEventArgs<T> object, which provides details about the before save action in the grid.
Examples
This example shows how to handle the RowUpdating event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" RowUpdating ="RowUpdatingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task RowUpdatingHandler (RowUpdatingEventArgs<Order> args)
{
args.Cancel = true; // To cancel the save action.
}
Searched
Gets or sets the event callback that is raised after the search action is performed in the grid.
Declaration
public EventCallback<SearchedEventArgs> Searched { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<SearchedEventArgs> | An event callback function. |
Remarks
The event handler receives a SearchedEventArgs object, which provides details about the after-search action in the grid.
Examples
This example shows how to handle the Searched event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" Searched="SearchedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task SearchedHandler (SearchedEventArgs args)
{
var searchResult = args.SearchString; // Gets the search result.
}
Searching
Gets or sets the event callback that is raised before the search action is performed in the grid.
Declaration
public EventCallback<SearchingEventArgs> Searching { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<SearchingEventArgs> | An event callback function. |
Remarks
This event handler receives a SearchingEventArgs object, which provides details about the search action in the grid.
Examples
This example shows how to handle the Searching event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" Searching ="SearchingHandler"></GridEvents>
........
</SfGrid>
@code {
public async Task SearchingHandler (SearchingEventArgs args)
{
args.Cancel = true; // To cancel the search begin action.
}
Sorted
Gets or sets the event callback that is raised after sorting action is performed in the grid.
Declaration
public EventCallback<SortedEventArgs> Sorted { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<SortedEventArgs> | An event callback function. |
Remarks
The event handler receives a SortedEventArgs object, which provides details about the after sorting action in the grid.
Examples
This example shows how to handle the Sorted event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" Sorted="SortedHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task SortedHandler(SortedEventArgs args)
{
var direction = args.Direction; // Gets the current sorting direction.
}
Sorting
Gets or sets the event callback that is invoked before a sorting action is performed or a column is removed from sorting in the grid or when the sort column direction changes from Ascending to Descending or vice versa for the same column.
Declaration
public EventCallback<SortingEventArgs> Sorting { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<SortingEventArgs> | An event callback function. |
Remarks
The event handler receives a SortingEventArgs object, which provides details about the before sorting action or a column is removed from sorting in the grid or when the sort column direction changes from Ascending
to Descending
or vice versa for the same column.
Examples
This example shows how to handle the Sorting event:
<SfGrid DataSource="@Orders" @ref="DefaultGrid" >
<GridEvents TValue="Orders" Sorting="SortingHandler"></GridEvents>
........
</SfGrid>
@code{
public async Task SortingHandler(SortingEventArgs args)
{
args.Cancel = true; // To cancel the sorting action.
}
Methods
OnInitializedAsync()
Declaration
protected override Task OnInitializedAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |