Questions tagged [html.labelfor]

8 questions
38
votes
2 answers

Why should I use LabelFor in MVC?

Why should I use LabelFor instead of
Jamie
  • 779
  • 1
  • 9
  • 17
3
votes
2 answers

Why don't modifications to an @Html.LabelFor value persist?

I am new to MVC 4, What I want to do is, make a label that display increment integer in cshtml page @Html.LabelFor(m => m.Increment, Model.Increment) in controller page public ActionResult Index(IncrementModel IM){ IM.Increment ++; return…
Yu Yenkan
  • 745
  • 1
  • 9
  • 32
1
vote
1 answer

LabelFor doesn't work when I use DataAnnotations and DisplayName - ASP.NET MVC

I have a folder called "ModelMetaData.cs" where I have a class called "InspeccioModelMetaData.cs" with these code: [DisplayName("Id")] public string IdInspeccio { get; set; } [DisplayName("Data de caducitat")] public DateTime DataCaducitat { get;…
1
vote
1 answer

MVC 4 LabelFor extension combine text and url

I'm trying to build a form in MVC 4 that will have at the end a check box in the following format: _ |_| I agree to Terms & Conditions where Terms and Conditions are actual URLs to the terms and conditions pages. How I can Implement…
user2818430
  • 5,853
  • 21
  • 82
  • 148
0
votes
1 answer

HTML.LabelFor doesn't render properly

I am trying to use Html.LabelFor like this but it doesn't render properly i.e instead of showing ProviderName value like "AT&T" its just displaying ProviderName text and not the value of ProviderName.
Huma Ali
  • 1,759
  • 7
  • 40
  • 66
0
votes
1 answer

html.labelfor doesn't accept any css class as an input

I have two projects in mvc . in one of them i use this code : @Html.LabelFor(model => model.Subject, new { @class = "control-label col-lg-2" }) And it works correctly because the project has an extension method for labelfor as you can see here…
Ehsan Akbar
  • 6,977
  • 19
  • 96
  • 180
0
votes
1 answer

ASP.NET HTML.LabelFor From Collection of Models

Ok im very new to ASP.NET 4.5 (giving PHP a break) and stuck with rendering a label. I have a ViewModel that defines the necessary Models : public class TransactionsViewModel { public IEnumerable Transactions { get; set; } …
M.Alnashmi
  • 582
  • 1
  • 4
  • 15
0
votes
1 answer

MVC Helper @Html.LabelFor not showing up?

Am I missing a reference or something? I have a reference to System.Web.Mvc 4.0x But whenever I try this @Html.LabelFor(x=>Model.yadda, new {id="_lblYadda"}); I get nothing I can't even get it to compile. I only have a reference to …
Proximo
  • 6,235
  • 11
  • 49
  • 67