Questions tagged [html-helper]

Refers to the `HtmlHelper` class for ASP.NET MVC views.

HtmlHelper is a helper class specific to ASP.NET MVC. The platform includes extension methods for this class that can be used to render HTML markup given the model and other inputs.

The canonical example is the DisplayFor method, which renders a display for a given model property. In Razor syntax, it looks like this, which renders the value of SomeProperty belonging to the current model class:

@Html.DisplayFor(model => model.SomeProperty)

The volume of methods available in HTML Helper is extensive, and they make use of data annotations (for string formatting and client-side validation). Their usefulness makes them a core part of the ASP.NET MVC framework.

2251 questions
0
votes
1 answer

Disable HTML datepicker with calendar icon using jquery

I have the following UI, I've set when dropdown select "None" Date From and Date To pickers are disabled, but still calender icon is clickable this is the issue when dropdown select "Other" Date From and Date To pickers are enabled, in correct…
kez
  • 2,273
  • 9
  • 64
  • 123
0
votes
1 answer

ADDING Labels in MVC2

How on earth do you add labels in MVC2? Intellisence says that there is an overload for label that takes 2 strings. I am getting an error telling me there is no such overload. And there doesn't appear to be any documentation anywhere telling how…
SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195
0
votes
0 answers

Asp MVC CheckBoxFor help needed in postback validation

Probably I'm missing something in this. I need a checkbox to be checked by the user when he submits a form. If he hasn't check the checkbox I need the ModelState.IsValid to be false and return back. All the examples found give me IsChecked()…
ReneRam
  • 71
  • 9
0
votes
1 answer

htmlHelper.Label and jquery Validation

I am trying to do some jQuery validation. I am having a hard time getting a label into my project... The Label will part of a jQuery UI Dialog, and whenever I have that label in my assignment jQuery UI dialog wont lode the div. I am a little…
SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195
0
votes
1 answer

ASP.NET MVC Html Helper doesn't render attribute ID when name starts with a number

I found some strange behavior of HTML helpers for me. It works fine in MVC 1 But have a problem in MVC 2 and MVC 3 So, I have next layout: in MVC 2: <%= Html.Hidden("123Test", "Without ID") %> <%= Html.Hidden("Test123", "With ID") %> or in MVC…
Anton Palyok
  • 1,249
  • 1
  • 16
  • 27
0
votes
1 answer

How to create custom HtmlHelper for nullable Boolean radio button group in .NET Core

Trying to make a custom MVC control [Display(Name = "Do you agree?")] [Required] public bool? Agree { get; set; }
0
votes
2 answers

how to external JavaScript in HTML and CSS

here is a code of HTML including JS and I want the JS to be an external file but it wont work , how to solve it and make the element move while clicking when it external