I am new in ASP.NET Core and would like to ask about displaying a field in w a view. I have a
class Person {
public string Name {get; set;}
public string Nickname {get; set;}
}
Typically, in the EditPerson
View, I do
<input asp-for="Name" class="form-control" />
<input asp-for="Nickname" class="form-control" />
to display the fields.
But in my EditPerson
View I need to display Name
as readonly, and Nickname
as editable field.
The Name
should not be in a textbox(even readonly), but rather in a label or div...
Is there a standard approach to display such fields?
I don't want that the field to be updated back to the model or DB, I need only reading the field.
<input asp-for="Name" class="form-control" readonly >
and take a look to ux.stackexchange.com/a/136269