Hello
In Blazor webassembly (dot net 6) project while selecting any row in sfGrid I am getting below error.
I am using sfGrid version 19.3.0.57
blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Syncfusion.Blazor.Grids.Internal.Selection`1.
at Syncfusion.Blazor.Grids.Internal.Selection`1.
at Syncfusion.Blazor.Grids.Internal.Selection`1.
at Syncfusion.Blazor.Grids.Internal.Selection`1.
at Syncfusion.Blazor.Grids.Internal.GridCellBase`1.
at Syncfusion.Blazor.Grids.Internal.GridCell`1.<
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Below is the code I used
@using Syncfusion.Blazor.Grids
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowGrouping="false">
<GridPageSettings PageSize="5"></GridPageSettings>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
</SfGrid>
@code{
public List<Order> Orders { get; set; }
SfGrid<Order> Grid { get; set; }
protected override void OnInitialized()
{
Orders = Enumerable.Range(1, 75).Select(x => new Order()
{
OrderID = 1000 + x,
CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
Freight = 2.1 * x,
OrderDate = DateTime.Now.AddDays(-x),
}).ToList();
}
public class Order {
public int? OrderID { get; set; }
public string CustomerID { get; set; }
public DateTime? OrderDate { get; set; }
public double? Freight { get; set; }
}
}
I am also facing this issue after I upgraded to Version="19.3.0.57".
Using .Net 6 and Blazor server side.
Please kindly fix this issue ASAP.
Thank you very much for your support.
I am experiencing the same problem with the same environment as Tarik. Could you please allow me access to the resolution link. Thank you.
Dear Renjith
Thank you so much for solving this issue.
Best Regards.
Hi Renjith,
after upgrading the framework to the 19.3.0.59 version, still, I am getting this warning on the solution file, not showing on UI.
same error when readasync is triggered
public override async Task<Object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null)
{
var data = new List<Student>();
try
{
int Id = 0;
if (dataManagerRequest.Params != null && dataManagerRequest.Params.Count > 0)
{
var val = dataManagerRequest.Params;
if (val.FirstOrDefault(o => o.Key == "StudentId").Value != null)
{
Id = Convert.ToInt32(val.FirstOrDefault(o => o.Key == "StudentId").Value.ToString());
}
}
data = await Repo.GetAllStudentAsync();
}
catch (Exception ex)
{
toastService.ShowError(ex.Message.ToString());
}
IEnumerable GridData = data;
int _count = data.Count;
if (dataManagerRequest.Search != null && dataManagerRequest.Search.Count > 0)
{
// Searching
GridData = DataOperations.PerformSearching(GridData, dataManagerRequest.Search);
}
if (dataManagerRequest.Where != null && dataManagerRequest.Where.Count > 0)
{
// Filtering
GridData = DataOperations.PerformFiltering(GridData, dataManagerRequest.Where, dataManagerRequest.Where[0].Operator);
}
if (dataManagerRequest.Sorted?.Count > 0) // perform Sorting
{
GridData = DataOperations.PerformSorting(GridData, dataManagerRequest.Sorted);
}
if (dataManagerRequest.Skip != 0)
{
GridData = DataOperations.PerformSkip(GridData, dataManagerRequest.Skip); //Paging
}
if (dataManagerRequest.Take != 0)
{
GridData = DataOperations.PerformTake(GridData, dataManagerRequest.Take);
}
IDictionary<string, object> aggregates = new Dictionary<string, object>();
if (dataManagerRequest.Aggregates != null) // Aggregation
{
aggregates = DataUtil.PerformAggregation(GridData, dataManagerRequest.Aggregates);
}
if (dataManagerRequest.Group != null && dataManagerRequest.Group.Any()) //Grouping
{
foreach (var group in dataManagerRequest.Group)
{
GridData = DataUtil.Group<Student>(GridData, group, dataManagerRequest.Aggregates, 0, dataManagerRequest.GroupByFormatter);
}
}
return dataManagerRequest.RequiresCounts ? new DataResult() { Result = GridData, Count = _count, Aggregates = aggregates } : (object)GridData;
}
Hi
IBS,
Greetings from Syncfusion,
We are unable to reproduce the reported issue when attempting to reproduce the
issue in the latest version 25.1.35. For your reference we have attached
simple sample.
So, to
further
proceed with the reporting problem, we require some additional clarification
from your end. Please share the below details to proceed further at our end.
Above-requested details will be very helpful in validating the reported query at our end and providing a solution as early as possible. Thanks for your understanding.
Regards,
Prathap S