Reputation: 321
My code is in ASP.Net mvc4 . in this only label is coming not data.
<div class="display-label">
@Html.DisplayNameFor(model => model.Leader.Name)
</div>
<div class="display-field">
<!-- @Html.DisplayFor(model => model.Leader.Name) --->
@Html.DisplayFor(model => model.Leader.Name )
</div>
Upvotes: 0
Views: 123
Reputation: 47804
you can use the following..
if you only want to display then use @Model.Leader.Name
and if you want to allow user to change this value use @Html.TextBoxFor(
<div class="display-label">
@Html.DisplayNameFor(model => model.Leader.Name)
</div>
<div class="display-field">
@Model.Leader.Name
</div>
<div class="display-field">
@Html.TextBoxFor(model => model.Leader.Name)
</div>
Hope this helps !
Upvotes: 0