What is the difference between Html.Label
and Html.Display
?
Html.Label()
renders HTML markup <label />
that can be used for a model entity's attrubute.
For eg,
<%= Html.Label("Full Name", Model.FullName) %>
would render
<label for="FullName">Full Name </label>
Html.Display()
on the other hand renders HTML markup for entire entity based on specified templates. For eg. if you have a Person entity with multiple attributes, you define a template with markup as to how to render a Person and Html.Display()
uses that template to render Person objects across views. Phil Haack has an excellent post on display templates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With