Using Html.DisplayNameFor helper to generate some titles.

This commit is contained in:
Praburaj 2014-04-16 17:12:23 -07:00
parent 20d0fc9bd8
commit 506b439f2f
2 changed files with 9 additions and 14 deletions

View File

@ -13,7 +13,7 @@
<hr />
<dl class="dl-horizontal">
<dt>
@Html.NameFor(model => model.Artist.Name)
@Html.DisplayNameFor(model => model.Artist.Name)
</dt>
<dd>
@ -21,7 +21,7 @@
</dd>
<dt>
@Html.NameFor(model => model.Genre.Name)
@Html.DisplayNameFor(model => model.Genre.Name)
</dt>
<dd>
@ -29,7 +29,7 @@
</dd>
<dt>
@Html.NameFor(model => model.Title)
@Html.DisplayNameFor(model => model.Title)
</dt>
<dd>
@ -37,7 +37,7 @@
</dd>
<dt>
@Html.NameFor(model => model.Price)
@Html.DisplayNameFor(model => model.Price)
</dt>
<dd>
@ -45,7 +45,7 @@
</dd>
<dt>
@Html.NameFor(model => model.AlbumArtUrl)
@Html.DisplayNameFor(model => model.AlbumArtUrl)
</dt>
<dd>

View File

@ -24,23 +24,18 @@
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
@*Bug: Html.NameFor does not contain an overload taking in IEnumerable<Tmodel>*@
<tr>
<th>
@*@Html.NameFor(model => model.Genre.Name)*@
@Html.NameFor(model => model.FirstOrDefault().Genre.Name)
@Html.DisplayNameFor(model => model.Genre.Name)
</th>
<th>
@*@Html.NameFor(model => model.Artist.Name)*@
@Html.NameFor(model => model.FirstOrDefault().Artist.Name)
@Html.DisplayNameFor(model => model.FirstOrDefault().Artist.Name)
</th>
<th>
@*@Html.NameFor(model => model.Title)*@
@Html.NameFor(model => model.FirstOrDefault().Title)
@Html.DisplayNameFor(model => model.FirstOrDefault().Title)
</th>
<th>
@*@Html.NameFor(model => model.Price)*@
@Html.NameFor(model => model.FirstOrDefault().Price)
@Html.DisplayNameFor(model => model.FirstOrDefault().Price)
</th>
<th></th>
</tr>