dan henderson
asked on
using DisplayFor in a table
I am trying to use DisplayFor in a table like so:
<table>
<tr>
<td>@html.LabelFor(model => model.name)</td>
<td>@html.DisplayFor(model => model.name)</td>
<td>@html.LabelFor(model => model.street)</td>
<td>@html.DisplayFor(model => model.street)</td>
</tr>
</table>
BUT, it displays the labels together and then the values! I don't understand!
<table>
<tr>
<td>@html.LabelFor(model => model.name)</td>
<td>@html.DisplayFor(model
<td>@html.LabelFor(model => model.street)</td>
<td>@html.DisplayFor(model
</tr>
</table>
BUT, it displays the labels together and then the values! I don't understand!
ASKER
Your post is exactly what I started with ... in fact, that is how my Edit view is contructed. But when I used the @Html.DisplayFor() it put the displayed values at the end of the line with all the LabelFor()'s at the start of the line:
label, label, displayfor, displayfor. That is why I tried using a table, so the alignment would be correct (although it isn't).
I am using VS 2017 and MVC 5.
label, label, displayfor, displayfor. That is why I tried using a table, so the alignment would be correct (although it isn't).
I am using VS 2017 and MVC 5.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
P.S. I f more help needed please post VS/asp.net mvc version as well as a screenshot of what you have vs what you would like to see (Use excel to prototype)