Reputation: 32758
I am using the following to display a label and then the value of the field:
<div>@Html.LabelFor(model => model.PageMeta.DataSourceText)</div>
<div>@Html.TextBoxFor(model => model.PageMeta.DataSourceText)</div>
But the TextBoxFor creates a text box that I can enter data into and the field is just for information only and needs to be read only. What I need is for some Html extension that will give me the value but not in a text box. How can I do this?
Upvotes: 0
Views: 72
Reputation: 32437
You don't need any extension methods. Just output the value to the page. If PageMeta
can be null you should handle that also.
<div>@Html.LabelFor(model => model.PageMeta.DataSourceText)</div>
<div>@Model.PageMeta.DataSourceText</div>
Upvotes: 1