Hello,
I have added the SfGrid component at my Blazor project and I have the Update button at my toolbar.
I would like to know if there is an event triggered when specifically the Update button is clicked and not any other button of the Toolbar.
If there is not such event I would like to know how to implement it and assign it at the Update button
Here is my SfGrid component
<SfGrid DataSource="Measurements" @ref="Grid" Toolbar="@(new List<string>() { "Add", "Update", "Cancel","Search","Delete" })" >
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" NewRowPosition="NewRowPosition.Bottom" Mode="EditMode.Batch">
</GridEditSettings>
<GridColumns>
<GridColumn Field=@nameof(Measurement.OrderID)
HeaderText="Order ID"
IsPrimaryKey="true"
Width="120"></GridColumn>
<GridColumn Field=@nameof(Measurement.Name)
HeaderTextAlign="TextAlign.Center"
HeaderText="Name"
AllowAdding="true"
ValidationRules="@(new ValidationRules{ Required= true})">
</GridColumn>
</GridColumns>
</SfGrid>
Thanks in advance!
|
<SfGrid ID="Grid" DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })" Height="315">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Batch"></GridEditSettings>
<GridEvents OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" ValidationRules="@(new ValidationRules { Required = true })" Type="ColumnType.Number" Width="120"></GridColumn>
. . .
</GridColumns>
</SfGrid>
@code{
public List<Order> Orders { get; set; }
.. .
public void ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)
{
if(args.Item.Text == "Update")
{
// Here, you can customize your code.
}
}
} |