New to Telerik UI for Blazor? Download free 30-day trial

Editing does not Work When Model Properties are Read-Only or Without Setters

Environment

Product Grid for Blazor,
Scheduler for Blazor

Description

Editing does not work, and the OnUpdate event does not fire when a property in my bound model does not have a setter or is read-only.

Error Message

If the Telerik source code is attached to the app, the following exception is thrown:

System.ArgumentException: Property set method not found.

Cause

By design, the component clones the edited data item, so the user can cancel editing and restore the original value. When the Grid clones the item, the component creates a new model instance and tries to set its properties. However, when some properties are read-only, the component is unable to set their properties, and an exception is thrown.

Solution

Currently, the only solution is to bind the component to a view model with non-read-only properties with setters. If the reason for using read-only properties is to prevent editing in some columns, you can set Editable="false" to the column in question.

Notes

There is an open feature request that will allow developers to populate the cloned edit item manually, this will be an alternative solution to this scenario.

In this article