I'm getting the following error from SetPersistDataAsync(state)
"JSON contains a property name not found in the type. PropertyName=validationRules"
after upgrade the 20.1.0.60 to 20.2.0.45
The json being loaded is and was created by 20.1.0.60 but will not load in 20.2.0.45
{
"columns": [
{
"allowEditing": true,
"allowAdding": true,
"allowFiltering": true,
"allowGrouping": true,
"allowReordering": true,
"allowResizing": true,
"allowSearching": true,
"allowSorting": true,
"autoFit": false,
"clipMode": "Ellipsis",
"disableHtmlEncode": true,
"displayAsCheckBox": false,
"editType": "DefaultEdit",
"enableGroupByFormat": true,
"field": "UserName",
"headerText": "User name",
"headerTextAlign": "Left",
"hideAtMedia": "",
"index": 0,
"isFrozen": false,
"isIdentity": false,
"isPrimaryKey": true,
"lockColumn": false,
"maxWidth": "",
"minWidth": "",
"showColumnMenu": true,
"showInColumnChooser": true,
"textAlign": "Left",
"freeze": "Left",
"type": "String",
"uid": "grid-column0",
"visible": true,
"width": "15%"
},
{
"allowEditing": true,
"allowAdding": true,
"allowFiltering": true,
"allowGrouping": true,
"allowReordering": true,
"allowResizing": true,
"allowSearching": true,
"allowSorting": true,
"autoFit": false,
"clipMode": "Ellipsis",
"disableHtmlEncode": true,
"displayAsCheckBox": false,
"editType": "DefaultEdit",
"enableGroupByFormat": true,
"field": "FirstName",
"headerText": "First name",
"headerTextAlign": "Left",
"hideAtMedia": "",
"index": 1,
"isFrozen": false,
"isIdentity": false,
"isPrimaryKey": false,
"lockColumn": false,
"maxWidth": "",
"minWidth": "",
"showColumnMenu": true,
"showInColumnChooser": true,
"textAlign": "Left",
"freeze": "Left",
"type": "String",
"uid": "grid-column1",
"validationRules": {
"Required": true,
"MinLength": 2,
"MaxLength": 256,
"Messages": {}
},
"visible": true,
"width": "15%"
},
{
"allowEditing": true,
"allowAdding": true,
"allowFiltering": true,
"allowGrouping": true,
"allowReordering": true,
"allowResizing": true,
"allowSearching": true,
"allowSorting": true,
"autoFit": false,
"clipMode": "Ellipsis",
"disableHtmlEncode": true,
"displayAsCheckBox": false,
"editType": "DefaultEdit",
"enableGroupByFormat": true,
"field": "SecondName",
"headerText": "Second name",
"headerTextAlign": "Left",
"hideAtMedia": "",
"index": 2,
"isFrozen": false,
"isIdentity": false,
"isPrimaryKey": false,
"lockColumn": false,
"maxWidth": "",
"minWidth": "",
"showColumnMenu": true,
"showInColumnChooser": true,
"textAlign": "Left",
"freeze": "Left",
"type": "String",
"uid": "grid-column2",
"validationRules": {
"Required": true,
"MinLength": 2,
"MaxLength": 256,
"Messages": {}
},
"visible": true,
"width": "15%"
},
{
"allowEditing": true,
"allowAdding": true,
"allowFiltering": true,
"allowGrouping": true,
"allowReordering": true,
"allowResizing": true,
"allowSearching": true,
"allowSorting": true,
"autoFit": false,
"clipMode": "Ellipsis",
"disableHtmlEncode": true,
"displayAsCheckBox": false,
"editType": "DefaultEdit",
"enableGroupByFormat": true,
"field": "RoleId",
"headerText": "Role",
"headerTextAlign": "Left",
"hideAtMedia": "",
"index": 3,
"isFrozen": false,
"isIdentity": false,
"isPrimaryKey": false,
"lockColumn": false,
"maxWidth": "",
"minWidth": "",
"showColumnMenu": true,
"showInColumnChooser": true,
"textAlign": "Left",
"freeze": "Left",
"type": "String",
"uid": "grid-column3",
"visible": true,
"width": "10%"
},
{
"allowEditing": true,
"allowAdding": true,
"allowFiltering": true,
"allowGrouping": true,
"allowReordering": true,
"allowResizing": true,
"allowSearching": true,
"allowSorting": true,
"autoFit": false,
"clipMode": "Ellipsis",
"disableHtmlEncode": true,
"displayAsCheckBox": false,
"editType": "DefaultEdit",
"enableGroupByFormat": true,
"field": "Email",
"headerText": "Email",
"headerTextAlign": "Left",
"hideAtMedia": "",
"index": 4,
"isFrozen": false,
"isIdentity": false,
"isPrimaryKey": false,
"lockColumn": false,
"maxWidth": "",
"minWidth": "",
"showColumnMenu": true,
"showInColumnChooser": true,
"textAlign": "Left",
"freeze": "Left",
"type": "String",
"uid": "grid-column4",
"validationRules": {
"Required": true,
"Email": true,
"Messages": {}
},
"visible": true,
"width": "15%"
},
{
"allowEditing": true,
"allowAdding": true,
"allowFiltering": true,
"allowGrouping": true,
"allowReordering": true,
"allowResizing": true,
"allowSearching": true,
"allowSorting": true,
"autoFit": false,
"clipMode": "Ellipsis",
"disableHtmlEncode": true,
"displayAsCheckBox": false,
"editType": "DatePickerEdit",
"enableGroupByFormat": true,
"field": "LastLogin",
"headerText": "Last Login",
"headerTextAlign": "Left",
"hideAtMedia": "",
"index": 5,
"isFrozen": false,
"isIdentity": false,
"isPrimaryKey": false,
"lockColumn": false,
"maxWidth": "",
"minWidth": "",
"showColumnMenu": true,
"showInColumnChooser": true,
"textAlign": "Left",
"freeze": "Left",
"type": "DateTime",
"uid": "grid-column5",
"visible": true,
"width": "10%"
},
{
"allowEditing": true,
"allowAdding": true,
"allowFiltering": true,
"allowGrouping": true,
"allowReordering": true,
"allowResizing": true,
"allowSearching": true,
"allowSorting": true,
"autoFit": false,
"clipMode": "Ellipsis",
"disableHtmlEncode": true,
"displayAsCheckBox": false,
"editType": "DefaultEdit",
"enableGroupByFormat": true,
"field": "StatusId",
"headerText": "Status",
"headerTextAlign": "Left",
"hideAtMedia": "",
"index": 6,
"isFrozen": false,
"isIdentity": false,
"isPrimaryKey": false,
"lockColumn": false,
"maxWidth": "",
"minWidth": "",
"showColumnMenu": true,
"showInColumnChooser": true,
"textAlign": "Left",
"freeze": "Left",
"type": "String",
"uid": "grid-column6",
"visible": true,
"width": "10%"
},
{
"allowEditing": true,
"allowAdding": true,
"allowFiltering": false,
"allowGrouping": false,
"allowReordering": true,
"allowResizing": true,
"allowSearching": true,
"allowSorting": false,
"autoFit": false,
"clipMode": "Ellipsis",
"commands": [
{
"ButtonOption": {
"content": "",
"cssClass": "e-flat",
"disabled": false,
"enableRtl": false,
"iconCss": "e-icons e-edit",
"iconPosition": 0,
"isPrimary": false,
"isToggle": false
},
"Type": "Edit",
"Uid": "gridcommand0"
},
{
"ButtonOption": {
"content": "",
"cssClass": "e-flat",
"disabled": false,
"enableRtl": false,
"iconCss": "e-icons e-delete",
"iconPosition": 0,
"isPrimary": false,
"isToggle": false
},
"Type": "Delete",
"Uid": "gridcommand1"
},
{
"ButtonOption": {
"content": "",
"cssClass": "e-flat",
"disabled": false,
"enableRtl": false,
"iconCss": "e-icons e-update",
"iconPosition": 0,
"isPrimary": false,
"isToggle": false
},
"Type": "Save",
"Uid": "gridcommand2"
},
{
"ButtonOption": {
"content": "",
"cssClass": "e-flat",
"disabled": false,
"enableRtl": false,
"iconCss": "e-icons e-cancel-icon",
"iconPosition": 0,
"isPrimary": false,
"isToggle": false
},
"Type": "Cancel",
"Uid": "gridcommand3"
}
],
"disableHtmlEncode": true,
"displayAsCheckBox": false,
"editType": "DefaultEdit",
"enableGroupByFormat": true,
"field": "",
"headerText": "Edit accounts",
"headerTextAlign": "Left",
"hideAtMedia": "",
"index": 7,
"isFrozen": false,
"isIdentity": false,
"isPrimaryKey": false,
"lockColumn": false,
"maxWidth": "",
"minWidth": "",
"showColumnMenu": true,
"showInColumnChooser": true,
"textAlign": "Center",
"freeze": "Left",
"type": "None",
"uid": "grid-column7",
"visible": true,
"width": "10%"
}
],
"filterSettings": {
"Columns": [],
"EnableCaseSensitivity": false,
"IgnoreAccent": false,
"ImmediateModeDelay": 1500,
"Mode": "OnEnter",
"ShowFilterBarStatus": true,
"Type": "Excel"
},
"searchSettings": {
"IgnoreAccent": false,
"IgnoreCase": true,
"Key": "",
"Operator": "None"
},
"sortSettings": {
"AllowUnsort": true,
"Columns": []
},
"groupSettings": {
"AllowReordering": false,
"DisablePageWiseAggregates": false,
"ShowDropArea": true,
"ShowGroupedColumn": false,
"ShowToggleButton": false,
"ShowUngroupButton": true,
"EnableLazyLoading": false
},
"pageSettings": {
"CurrentPage": 1,
"EnableQueryString": false,
"PageCount": 8,
"PageSize": 25,
"PageSizes": [ 5, 10, 15, 20, 25, 50, 100, 250 ],
"EnableExternalMessage": false
},
"isPersistAutoFit": false
}
Grid definition is:
<SfGrid ID="UserAccounts" [email protected] AllowPaging="true" AllowSorting="true" AllowMultiSorting="true" AllowFiltering="true" AllowResizing="true" AllowTextWrap="true" @ref=@GridUserAccounts>
<GridEvents TValue=@UserModel OnActionBegin=@GridOnActionBegin OnActionFailure=@GridOnActionFailure></GridEvents>
<GridEditSettings AllowEditing="true" AllowDeleting="true"></GridEditSettings>
<GridPageSettings [email protected] PageSize=@PageSize></GridPageSettings>
<GridFilterSettings [email protected]></GridFilterSettings>
<GridTemplates>
<EmptyRecordTemplate>
<span>@RecordsText</span>
</EmptyRecordTemplate>
</GridTemplates>
<GridColumns>
<GridColumn Field=@nameof(UserModel.UserName) HeaderText="User name" TextAlign="TextAlign.Left" IsPrimaryKey=@true Width="15%">
<Template>
@{
UserModel UserModelObj = (context as UserModel);
<div><a rel='nofollow' href="#" @onclick=@(() => EditUser(@UserModelObj)) @onclick:preventDefault>@UserModelObj.UserName</a></div>
}
</Template>
<EditTemplate>
@{
UserModel UserModelObj = (context as UserModel);
<div>@UserModelObj.UserName</div>
}
</EditTemplate>
</GridColumn>
<GridColumn Field=@nameof(UserModel.FirstName) HeaderText="First name" TextAlign="TextAlign.Left" ValidationRules=@(new ValidationRules{ Required=true, MinLength = 2, MaxLength = 256 }) Width="15%"/>
<GridColumn Field=@nameof(UserModel.SecondName) HeaderText="Second name" TextAlign="TextAlign.Left" ValidationRules=@(new ValidationRules{ Required=true, MinLength = 2, MaxLength = 256 }) Width="15%"/>
<GridColumn Field=@nameof(UserModel.RoleId) HeaderText="Role" TextAlign="TextAlign.Left" Width="10%">
<FilterItemTemplate>
@{
FilterItemTemplateContext filterContext = (context as FilterItemTemplateContext);
string itemTemplateValue = this.UserRoleListObj.First(x => x.RoleId == ((UserModel)filterContext.Record).RoleId).RoleName;
}
@itemTemplateValue
</FilterItemTemplate>
<Template>
@{
UserModel UserModelObj = (context as UserModel);
<div>@UserRoleListObj.First(x => x.RoleId == UserModelObj.RoleId).RoleName</div>
}
</Template>
<EditTemplate>
@{
UserModel UserModelObj = (context as UserModel);
<SfDropDownList DataSource=this.UserRoleListObj TValue=string TItem=@RoleModel @bind-Value=UserModelObj.RoleId>
<DropDownListFieldSettings Value=@nameof(RoleModel.RoleId) Text=@nameof(RoleModel.RoleName) />
</SfDropDownList>
}
</EditTemplate>
</GridColumn>
<GridColumn Field=@nameof(UserModel.Email) HeaderText="Email" TextAlign="TextAlign.Left" ValidationRules=@(new ValidationRules{ Required=true, Email=true }) Width="15%"/>
<GridColumn Field=@nameof(UserModel.LastLogin) HeaderText="Last Login" TextAlign="TextAlign.Left" Width="10%">
<FilterItemTemplate>
@{
FilterItemTemplateContext filterContext = (context as FilterItemTemplateContext);
<div>@(((UserModel)filterContext.Record).LastLogin.Value.ToString(DateTimeFormat))</div>
}
</FilterItemTemplate>
<Template>
@{
UserModel UserModelObj = (context as UserModel);
@if (UserModelObj.LastLogin.HasValue)
{
<div>@UserModelObj.LastLogin.Value.ToString(DateTimeFormat)</div>
}
}
</Template>
<EditTemplate>
@{
UserModel UserModelObj = (context as UserModel);
@if (UserModelObj.LastLogin.HasValue)
{
<div>@UserModelObj.LastLogin.Value.ToString(DateTimeFormat)</div>
}
}
</EditTemplate>
</GridColumn>
<GridColumn Field=@nameof(UserModel.StatusId) HeaderText="Status" TextAlign="TextAlign.Left" Width="10%">
<FilterItemTemplate>
@{
FilterItemTemplateContext filterContext = (context as FilterItemTemplateContext);
string itemTemplateValue = this.StaticDataObj.UserStatusList.First(x => x.StatusId == ((UserModel)filterContext.Record).StatusId).StatusName;
}
@itemTemplateValue
</FilterItemTemplate>
<Template>
@{
UserModel UserModelObj = (context as UserModel);
<div>@this.StaticDataObj.UserStatusList.First(x => x.StatusId == UserModelObj.StatusId).StatusName</div>
}
</Template>
<EditTemplate>
@{
UserModel UserModelObj = (context as UserModel);
@if (UserModelObj.StatusId == UserStatusType.LOGGEDON)
{
<div>@this.StaticDataObj.UserStatusList.First(x => x.StatusId == UserModelObj.StatusId).StatusName</div>
}
else
{
<SfDropDownList DataSource=this.UserStatusTypeEditListObj TValue=string TItem=@UserStatusType @bind-Value=UserModelObj.StatusId>
<DropDownListFieldSettings Value=@nameof(UserStatusType.StatusId) Text=@nameof(UserStatusType.StatusName) />
</SfDropDownList>
}
}
</EditTemplate>
</GridColumn>
<GridColumn HeaderText="Edit accounts" TextAlign="TextAlign.Center" Width="10%">
<GridCommandColumns>
<GridCommandColumn Type="CommandButtonType.Edit" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-edit", CssClass = "e-flat" })"></GridCommandColumn>
<GridCommandColumn Type="CommandButtonType.Delete" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-delete", CssClass = "e-flat" })"></GridCommandColumn>
<GridCommandColumn Type="CommandButtonType.Save" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-update", CssClass = "e-flat" })"></GridCommandColumn>
<GridCommandColumn Type="CommandButtonType.Cancel" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-cancel-icon", CssClass = "e-flat" })"></GridCommandColumn>
</GridCommandColumns>
</GridColumn>
</GridColumns>
</SfGrid>
Hi Michael,
Greetings from Syncfusion support.
Query: “I'm getting the following error from SetPersistDataAsync(state) "JSON contains a property name not found in the type. PropertyName=validationRules" after upgrade the 20.1.0.60 to 20.2.0.45”
We have checked your query and we would like to inform that we have removed some properties from persistence settings for better performance. Kindly share us whether you are facing any issues due to the missing property in persisted Grid. If so kindly share us more details regarding the difficulties faced at your end. Based on that we will validate further at our end.
Please let us know if you have any concerns.
Regards,
Monisha
This does present a concern.
We picked up this problem in a test migration of our production deployed application that is currently using 20.1.0.60. If we deploy 20.2.0.45 any existing users will see this error.
The only solution I can see is to clear all the persistent grid settings for the users on migration, fortunately we persist the grid JSON to a backend database rather than the default cookie, but still this means the users loose all their grid settings.
Is there a way to strip out the unsupported elements from the JSON so loading in 20.2.0.45 does not cause the error?
Surely you should be providing a migration path for something like this.
Hi Michael,
Thanks for the update.
We have checked your shared query and Before proceeding further with your requirement kindly share us the way you have stored the persisted settings in the database. Based on your shared information we will check and update the possibility at our end.
Also if possible kindly share us the simple issue reproduceable sample. It will be very helpful for us to validate the reported query further at our end.
Kindly get back to us if you have further queries.
Regards,
Monisha