Top "Html-helper" questions

Refers to the `HtmlHelper` class for ASP.

How to add "required" attribute to mvc razor viewmodel text input editor

I have the following MVC 5 Razor HTML helper: @Html.TextBoxFor(m => m.ShortName, new { @class = "form-control", @placeholder = "short name"}) …

asp.net-mvc razor data-annotations html-helper
How can I add a class attribute to an HTML element generated by MVC's HTML Helpers?

ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink(), @Html.BeginForm() and so on. I …

asp.net-mvc razor html-helper
What is the difference between Html.Hidden and Html.HiddenFor

I can find a good definition for Html.HiddenFor on MSDN but the only thing I can find on Html.…

c# asp.net-mvc html-helper html.hiddenfor
Handling onchange event in HTML.DropDownList Razor MVC

I'm handling an onchange event with a selected value by simple HTML like this: <select onchange="location = this.value;"&…

asp.net-mvc asp.net-mvc-3 razor html-helper
How to change the display name for LabelFor in razor in mvc3?

In razor engine I have used LabelFor helper method to display the name But the display name is seems to …

asp.net-mvc-3 html-helper
HTML.HiddenFor value set

@Html.HiddenFor(model => model.title, new { id= "natureOfVisitField", @value = '@Model.title'}) it doesen't work! how to set the …

asp.net-mvc asp.net-mvc-3 html-helper html.hiddenfor
Razor HtmlHelper Extensions (or other namespaces for views) Not Found

Dunno if this was happening in the PR or Beta, but if I create an extension method on HtmlHelper, it …

asp.net-mvc-3 extension-methods razor html-helper
Current date and time - Default in MVC razor

When the MVC view page with this textbox, loads , I would like to display current date and time by default. …

asp.net-mvc asp.net-mvc-3 asp.net-mvc-2 razor html-helper
Adding CSS class to Html.BeginForm()

How to add class attribute for following situation (Using ReturnUrl only): @using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl })) { } I want …

.net css forms asp.net-mvc-4 html-helper
How to make the @Html.EditorFor Disabled

I have the following inside my asp.net mvc web application :- <div><span class="f">…

asp.net-mvc html-helper