Hi There,
I have a grid as follows:
<SfGrid @ref="AnswersGrid" DataSource="@AnswerList" Toolbar="@(new List<string>() { "Add", "Double Click On A Row To Edit"})" AllowSelection="true" AllowPaging="false" AllowSorting="true" AllowFiltering="false" AllowTextWrap="false">
<GridEditSettings AllowEditOnDblClick="true" AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Normal" NewRowPosition="NewRowPosition.Bottom"></GridEditSettings>
<GridEvents OnActionComplete="OnActionCompleteHandler" TValue="Answer"></GridEvents>
<GridSortSettings>
<GridSortColumns>
<GridSortColumn Field="@nameof(Answer.Label)" Direction="SortDirection.Ascending"></GridSortColumn>
</GridSortColumns>
</GridSortSettings>
<GridColumns>
<GridColumn AllowSorting="false" Field="@nameof(Answer.OrgId)" Visible="false" DefaultValue="@Element.OrgId" />
<GridColumn AllowSorting="true" Field="@nameof(Answer.Label)" Width="100" IsPrimaryKey="true" HeaderText="Label" DefaultValue="@DefaultLabelValue" ValidationRules="@(new ValidationRules{ Required = true, MinLength = 1, MaxLength = 20})" />
<GridColumn AllowSorting="false" Field="@nameof(Answer.Points)" Width="100" HeaderText="Points" DefaultValue="0" ValidationRules="@(new ValidationRules { Required = true, Number = true , Min = 0})" />
<GridColumn AllowSorting="false" Field="@nameof(Answer.Value)" HeaderText="Answer Value" DefaultValue="@DefaultAnswerValue" ValidationRules="@(new ValidationRules { Required = true })" />
<GridColumn HeaderText="Change" Width="100">
<GridCommandColumns>
<GridCommandColumn Type="CommandButtonType.Edit" ButtonOption="@(new CommandButtonOptions() {CssClass="e-success", IconCss = "fa fa-pencil"})" />
<GridCommandColumn Type="CommandButtonType.Delete" ButtonOption="@(new CommandButtonOptions() {CssClass="e-danger", IconCss = "fa fa-trash"})" />
<GridCommandColumn Type="CommandButtonType.Save" ButtonOption="@(new CommandButtonOptions() {CssClass="e-success", IconCss="fa fa-save"})" />
<GridCommandColumn Type="CommandButtonType.Cancel" ButtonOption="@(new CommandButtonOptions() {CssClass="e-flat", IconCss="fa fa-times" })" />
</GridCommandColumns>
</GridColumn>
</GridColumns>
</SfGrid>
Which has been working fine for a while. Recently I upgraded to 18.2.0.58 , and it seems that the validation is now broken. The following exception is now thrown after I edit something in the grid.
2020-09-22 15:03:40.656 +12:00 [WRN] Unhandled exception rendering component: Value cannot be null. (Parameter 'propertyName')
System.ArgumentNullException: Value cannot be null. (Parameter 'propertyName')
at System.ComponentModel.DataAnnotations.ValidationAttributeStore.TypeStoreItem.TryGetPropertyStoreItem(String propertyName, PropertyStoreItem& item)
at System.ComponentModel.DataAnnotations.ValidationAttributeStore.TypeStoreItem.GetPropertyStoreItem(String propertyName)
at System.ComponentModel.DataAnnotations.ValidationAttributeStore.GetPropertyType(ValidationContext validationContext)
at System.ComponentModel.DataAnnotations.Validator.TryValidateProperty(Object value, ValidationContext validationContext, ICollection`1 validationResults)
at Syncfusion.Blazor.Grids.Internal.Editors.ColumnsValidator`1.DataAnnotationHandler(FieldIdentifier identifier)
at Syncfusion.Blazor.Grids.Internal.Editors.ColumnsValidator`1.ValidateRequested(Object editContext, ValidationRequestedEventArgs validationEventArgs)
at Microsoft.AspNetCore.Components.Forms.EditContext.Validate()
at Syncfusion.Blazor.Grids.Internal.Edit`1.EndEdit()
at Syncfusion.Blazor.Grids.Internal.GridCellBase`1.CellClickHandler(MouseEventArgs e, Boolean IsCheckBox)
at Syncfusion.Blazor.Grids.Internal.GridCell`1.<BuildRenderTree>b__0_5(MouseEventArgs e)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
Now I am not trying to use data annotations, although the underlying model for the grid ("Answer") does have some annotations. But then, it was not a problem before - the grid still worked just fine.
But its broken in the latest update. Any ideas?