I'm just learning how to do ASP MVC. All of the tutorials I see use a combination of Html.LabelFor and the DisplayAttribute. Personally, I'm not a big fan of adding these kinds of annotations to my model objects and I'd like to know if there is an accepted alternative. I thought this might be a place for something like Knockout or Backbone, but I'm so new to this stuff that I'm having difficulty wrapping my brain around the different pieces.
I know this has probably already been asked and answered; I can't even figure out how to google it :(
Thanks in advance
you can skip Data Annotations
you can write
<label for='@(var1)'>@Name</label>
or
<label for='name1'>Text</label>
or
Html.Label("ControlName", "Name")
or
Html.LabelFor with data anot.
any of this will be correct
also using helpers with lamda expressions (Html.LabelFor) is much slower than Html.Label or simple html code <label for='@(var1)'>@Name</label>
It is true for all asp.net mvc html helpers
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