How to show a readonly value on a page?

I am trying to display a readonly property on a page.

I have this code on the page:

<RadzenTextBox @bind-Value="@myObject.ReadonlyProperty" ReadOnly = "true" Style="display: block; width: 100%; height:200px" />

But I am getting the following error:

Property r indexer "ReadonlyProperty" can not be assigned to -- it is read-only

I also tried a RadzenLabel and got the same error.

How can I show read-only properties on a Blazor page?

Please note that the property is read-only and I want to show it and not change it.

This is a two-way binding - it can be used only for properties with setters.

So what is your advice in these situations? can I use any other component from Radzen to do this job?

The error is related to the framework itself and not related to our components. You can use two-way binding only with read/write properties otherwise you need simple one-way binding: Value="@myObject.ReadonlyProperty"

Thanks, I am going to use Value for binding instead of bind-value.

1 Like