Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

0
Votes

I've attached sample that produces the issue and I've determined the cause of it.  It is to do with enums and not having a default value if none is specified.  


23.2.7 (Tested this version and it's working)

Error:

blazor.server.js:1 [2023-12-28T17:23:18.113Z] Error: System.ArgumentNullException: Value cannot be null. (Parameter 'element')

at System.ArgumentNullException.Throw(String paramName)

at System.Attribute.GetCustomAttributes(MemberInfo element, Type attributeType, Boolean inherit)

at Syncfusion.Blazor.MetadataExtension.GetDisplayName(Enum enumValue)

at Syncfusion.Blazor.Grids.Internal.GridCellBase`1.GetValue()

at Syncfusion.Blazor.Grids.Internal.GridCellBase`1.OnParametersSetAsync()

at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)

at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()


Replication steps:

-->Run the attached sample you will see ths issue

@page "/s"

@using Syncfusion.Blazor.Grids
@using System.ComponentModel.DataAnnotations

<SfGrid @ref="Grid" DataSource="@dataSource" AllowSelection="true" Toolbar="@(new List<string>() {"Add", "Edit", "Delete", "Update", "Cancel"})">
    <GridEditSettings AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
   
    <GridColumns>
        <GridColumn Field="@nameof(DataItem.Id)"></GridColumn>


        <GridColumn Field="@nameof(DataItem.LineCategoryType)" HeaderText="Line Category" Visible="true" />

    </GridColumns>

</SfGrid>

@code{
    private SfGrid<DataItem> Grid;

    public List<DataItem> dataSource = new List<DataItem>()
    {
        new DataItem { Id = 1, ParentId = 1, ChildId = 1  },
        new DataItem { Id = 2, ParentId = 2, ChildId = 5, LineCategoryType = LineCategoryType.Basic }
    };

    public class DataItem
    {


        public int Id { get; set; }

        public int? ParentId { get; set; }

        public int? ChildId { get; set; }

        public LineCategoryType LineCategoryType { get; set; }
    }
    protected override async Task OnInitializedAsync()
    {

        await Task.CompletedTask;
    }



    public enum LineCategoryType
    {
        [Display(Name = "Basic")]
        Basic = 1,

        [Display(Name = "Trading")]
        Trading = 2,

        [Display(Name = "Accommodation")]
        Accommodation = 3,

        [Display(Name = "Opportunistic")]
        Opportunistic = 4,

        [Display(Name = "Non Renewable")]
        NonRenewable = 5
    }
   
}