c# - Display a readonly field in Asp.net Core -
i new in asp.net core , ask displaying field in w view. have
class person { public string name {get; set;} public string nickname {get; set;} }
typically, in edit person view,
<input asp-for="name" class="form-control" /> <input asp-for="nickname" class="form-control" />
to display fields.
but in edit person view need display name
readonly, , nickname
editable field.
the name
should not in textbox(even readonly), rather in label or div...
is there standard approach display such fields?
i don't want field updated model or db, need reading field.
output html razor syntax
https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor
@model.name <input asp-for="nickname" class="form-control" />
note - need styling appropriately, or wrapping in <span>
tag etc...
wiki
Comments
Post a Comment