I have saved a grid state in the cosmos db and I want to load that state from that db.But this error occurs.
Error: System.InvalidOperationException: Unable to set property 'Value' on object of type 'Radzen.Blazor.RadzenNumeric`1[[System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'. The error was: Unable to cast object of type 'System.Int64' to type 'System.Nullable`1[System.Int32]'.
---> System.InvalidCastException: Unable to cast object of type 'System.Int64' to type 'System.Nullable`1[System.Int32]'.
at Microsoft.AspNetCore.Components.Reflection.PropertySetter.CallPropertySetter[TTarget,TValue](Action`2 setter, Object target, Object value)
at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.<SetProperties>g__SetProperty|3_0(Object target, PropertySetter writer, String parameterName, Object value)
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.<SetProperties>g__SetProperty|3_0(Object target, PropertySetter writer, String parameterName, Object value)
at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.SetProperties(ParameterView& parameters, Object target)
at Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(ParameterView parameters)
at Radzen.RadzenComponent.<>n__0(ParameterView parameters)
at Radzen.RadzenComponent.SetParametersAsync(ParameterView parameters)
at Radzen.FormComponentWithAutoComplete`1.SetParametersAsync(ParameterView parameters)
at Radzen.Blazor.RadzenNumeric`1.SetParametersAsync(ParameterView parameters)
Then I checked your Blazor DataGrid Component - Save / Load Settings | Free UI Components by Radzen example and it uses System.Text.Json deserialization. It gives FilterValue for a column as JsonElement like this.
ValueKind = Number : "1"
ValueKind: Number
_idx: 0
_parent: {System.Text.Json.JsonDocument}
But when we retrieve FilterValue from cosmos db state it gives Int64 1.
How to handle this?