|
<SfGrid DataSource="@Orders" AllowPaging="true" Height="315">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>
<GridEvents TValue="Order" OnActionBegin="ActionBegin"></GridEvents>
..
</SfGrid>
@code{
public void ActionBegin(ActionEventArgs<Order> args) {
if (args.Action == "Edit" && args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.Save) && args.Data.Sum < 10) {
//For example, here we check the Sum column has valid value or not
args.Cancel = true;
}
}
} |
|
public static List<Order> Orders { get; set; } = new List<Order>();
public class Order
{
public int? OrderID { get; set; }
public string CustomerID { get; set; }
public DateTime? OrderDate { get; set; }
public int OrdQty { get; set; }
public int PicQty { get; set; }
[ShipCountryValidation]
public string ShipCountry { get; set; }
} |