I'v a grid and that is working correctly.
After add a SfButton and open an grid row for editing click on Save button in the edit window I got this error.
When I remove it everything is working fine again
Blazor Syncfusion 18.1.0.36-beta
.Net Core 3.1.2
VS 2019 version 16.4.5
Windows 10
Error:
Code:
@page "/SearchComboGrid"
@using Syncfusion.Blazor.Grids
@using Syncfusion.Blazor.Calendars
@using Syncfusion.Blazor.DropDowns
@using Syncfusion.Blazor.Inputs
@using Microsoft.JSInterop;
@using Action = Syncfusion.Blazor.Grids.Action
<SfButton @ref="ToggleBtn" @onclick="onToggleClick" CssClass="e-flat" IsToggle="true" IsPrimary="true" Content="Click me"></SfButton>
<SfGrid DataSource="@GridData"
@ref="Grid"
Toolbar="@(new string[] {"Add"})"
AllowSorting="true"
AllowPaging="true"
AllowFiltering="true"
AllowGrouping="true"
AllowRowDragAndDrop="true"
ShowColumnChooser="true"
ContextMenuItems="@(new List<string> { "Edit", "Delete" })">
<GridEditSettings Mode="EditMode.Dialog"
AllowAdding="true"
AllowEditing="true"
AllowDeleting="true"
ShowDeleteConfirmDialog="true"
NewRowPosition="NewRowPosition.Bottom" />
<GridColumns>
<GridColumn Field=@nameof(OrdersDetails.OrderID) HeaderText="Order ID" IsPrimaryKey="true" ValidationRules="@(new { required=true})" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(OrdersDetails.CustomerID) HeaderText="Customer Name" ValidationRules="@(new { required=true})" Width="120"></GridColumn>
<GridColumn Field=@nameof(OrdersDetails.OrderDate) HeaderText=" Order Date" EditType="EditType.DatePickerEdit" TextAlign="TextAlign.Right" Width="130" Type="ColumnType.Date" CustomFormat="@(new { type= "date", format= "dd/MM/yyyy" })" ></GridColumn>
<GridColumn Field=@nameof(OrdersDetails.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" EditType="EditType.NumericEdit" Width="120"></GridColumn>
@*<GridColumn Field=@nameof(OrdersDetails.ShipCountry) HeaderText="Ship Country" EditType="EditType.DropDownEdit" Width="150"></GridColumn>*@
</GridColumns>
</SfGrid>
@code{
[Inject]
IJSRuntime JsRuntime { get; set; }
object DateFormat = new { type = "date", format = "dd-MM-yyyy" };
SfGrid<OrdersDetails> Grid;
SfButton ToggleBtn;
private void onToggleClick(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
{
}
protected override void OnAfterRender(bool firstRender)
{
// this.JsRuntime.Sf().LoadLocaleData("wwwroot/nl.json").SetCulture("nl-NL").SetCurrencyCode("EUR");
}
public List<OrdersDetails> GridData = new List<OrdersDetails>
{
new OrdersDetails() { OrderID = Guid.NewGuid(), CustomerID = "VINET", Freight = 32.38, ShipCity = "Berlin", OrderDate = DateTime.Now.AddDays(-2), ShipName = "Vins et alcools Chevalier", ShipCountry = "Denmark", ShipAddress = "Kirchgasse 6" },
new OrdersDetails() { OrderID = Guid.NewGuid(), CustomerID = "TOMSP", Freight = 11.61, ShipCity = "Madrid", OrderDate = DateTime.Now.AddDays(-5), ShipName = "Toms Spezialitäten", ShipCountry = "Brazil", ShipAddress = "Avda. Azteca 123" },
new OrdersDetails() { OrderID = Guid.NewGuid(), CustomerID = "HANAR", Freight = 65.83, ShipCity = "Cholchester", OrderDate = DateTime.Now.AddDays(-12), ShipName = "Hanari Carnes", ShipCountry = "Germany", ShipAddress = "Carrera 52 con Ave. Bolívar #65-98 Llano Largo" },
new OrdersDetails() { OrderID = Guid.NewGuid(), CustomerID = "VICTE", Freight = 41.34, ShipCity = "Marseille", OrderDate = DateTime.Now.AddDays(-18), ShipName = "Victuailles en stock", ShipCountry = "Austria", ShipAddress = "Magazinweg 7" },
new OrdersDetails() { OrderID = Guid.NewGuid(), CustomerID = "SUPRD", Freight = 51.3, ShipCity = "Tsawassen", OrderDate = DateTime.Now.AddDays(-22), ShipName = "Suprêmes délices", ShipCountry = "Switzerland", ShipAddress = "1029 - 12th Ave. S." },
new OrdersDetails() { OrderID = Guid.NewGuid(), CustomerID = "HANAR", Freight = 58.17, ShipCity = "Tsawassen", OrderDate = DateTime.Now.AddDays(-26), ShipName = "Hanari Carnes", ShipCountry = "Switzerland", ShipAddress = "1029 - 12th Ave. S." },
new OrdersDetails() { OrderID = Guid.NewGuid(), CustomerID = "CHOPS", Freight = 22.98, ShipCity = "Berlin", OrderDate = DateTime.Now.AddDays(-34), ShipName = "Chop-suey Chinese", ShipCountry = "Denmark", ShipAddress = "Kirchgasse 6" },
new OrdersDetails() { OrderID = Guid.NewGuid(), CustomerID = "RICSU", Freight = 148.33, ShipCity = "Madrid", OrderDate = DateTime.Now.AddDays(-39), ShipName = "Richter Supermarket", ShipCountry = "Brazil", ShipAddress = "Avda. Azteca 123" },
new OrdersDetails() { OrderID = Guid.NewGuid(), CustomerID = "WELLI", Freight = 13.97, ShipCity = "Madrid", OrderDate = DateTime.Now.AddDays(-43), ShipName = "Wellington Importadora", ShipCountry = "Brazil", ShipAddress = "Avda. Azteca 123" },
new OrdersDetails() { OrderID = Guid.NewGuid(), CustomerID = "HILAA", Freight = 81.91, ShipCity = "Cholchester", OrderDate = DateTime.Now.AddDays(-48), ShipName = "HILARION-Abastos", ShipCountry = "Germany", ShipAddress = "Carrera 52 con Ave. Bolívar #65-98 Llano Largo" }
};
public class OrdersDetails
{
public Guid? OrderID { get; set; }
public string CustomerID { get; set; }
public double Freight { get; set; }
public string ShipCity { get; set; }
public DateTime? OrderDate { get; set; }
public string ShipName { get; set; }
public string ShipCountry { get; set; }
public string ShipAddress { get; set; }
}
}
<style>
.form-group.col-md-6 {
width: 200px;
}
label.e-float-text {
position: relative;
padding-left: 0;
top: 10%;
}
</style>
Attachment:
SyncfusionTest_9bf013fe.zip