html-helper Questions

9

Solved

I have an ASP.Net MVC 3 web application and I am adding a check box to a view page using the HtmlHelper class, like this... @Html.CheckBox("CheckBox1", true, new { @class = "Class1" }) What I wa...
Coke asked 2/11, 2011 at 9:33

13

Solved

I want to set disable attribute based on a condition for Html.TextBoxFor in asp.net MVC like below @Html.TextBoxFor(model => model.ExpireDate, new { style = "width: 70px;", maxlength = "10", id...
Circuitous asked 12/7, 2011 at 6:8

6

Solved

I have a DateTime field in my Model. If I try to use this field in a strong typed partial view this way <%= Html.TextBoxFor(model => model.DataUdienza.ToString("dd/MM/yyyy"), new { style = "...
Damal asked 17/9, 2010 at 11:19

7

Solved

I'm building an ASP.NET MVC application, using VB.NET and I'm trying to apply a css class to a Html.ActionLink using the code: <%=Html.ActionLink("Home", "Index", "Home", new {@class = "tab" })...
Cornelie asked 18/9, 2009 at 13:17

6

Solved

This view suppose to show a list of hyperlinks, each pointing to an external URL. The goal is for the user to click one of these links and have their browser open a new tab with the selected URL. C...
Clan asked 15/4, 2014 at 20:45

6

Solved

Is there anyway to have a SelectList prepopulated on ViewModel with data-attributes ? I want to do @Html.DropdownListFor(m=> m.CityId, Model.Cities); so it generates code like : <select...

5

Solved

As the question says: How to set selectedValue in DropDownListFor Html helper? Tried most of the other solutions but none worked that's why I am opening a new question. Nothing of these helped: ...
Unvoice asked 18/1, 2017 at 12:21

6

Solved

I can find a good definition for Html.HiddenFor on MSDN but the only thing I can find on Html.Hidden is related to problems it has. Can someone give me a good definition and an example.
Arturoartus asked 7/12, 2010 at 21:38

6

Solved

When the MVC view page with this textbox, loads , I would like to display current date and time by default. How can I do this? in razor. @Html.EditorFor(model => model.ReturnDate)

6

Solved

I'm not seeing a way to create, via the HtmlHelper, a SelectListItem that will spit out the following HTML: <option disabled="disabled">don't click this</option> The only properties ...
Vapid asked 16/4, 2010 at 17:38

4

Solved

The problem in Html.ActionLink() is that you can't add additional html content inside the tag that it generates. For example, if you want to add an icon besides the text like: <a href="/Admin/U...
Morentz asked 20/5, 2015 at 5:50

4

Solved

I've been trying to figure out the difference between RenderAction and Action. I don't know if I'm so concerned about the differences at this point, as to why I can't get RenderAction to work. From...
Revegetate asked 27/4, 2011 at 21:7

7

Solved

Hopefully an easy question for you asp.net mvc gurus: I have a checkbox, created like this: <%=Html.CheckBox("MyCheckBox", true, new { disabled = "disabled"})%> In my action I am checking...
Sepalous asked 17/1, 2011 at 21:58

13

Solved

Simple question, if you use the Html Helper from ASP.NET MVC Framework 1 it is easy to set a default value on a textbox because there is an overload Html.TextBox(string name, object value). When I ...
Klagenfurt asked 14/6, 2010 at 4:41

5

Solved

How do I generate a URL pointing to a controller action from a helper method outside of the controller?
Reminisce asked 5/2, 2011 at 15:1

4

Solved

I'm converting a project to ASP.NET Core. I need to migrate lots of reusable html helpers, but html helpers do not exist in Core. Some are complex, some simple. Here's a extremely simple example: ...
Hump asked 27/2, 2017 at 20:17

6

Solved

I have the following inside my asp.net mvc web application :- <div><span class="f">Data Center Name</span> @Html.EditorFor(model => model.Switch.TMSRack.DataCenter.Name, new {...
Distribution asked 31/10, 2013 at 10:17

5

Solved

It's possible to add a HTML title attribute to an input tag like so: @Html.TextBoxFor(model => model.Name, new { title = "Customer name" }) Is there a similar helper for static text? With @Ht...
Afflictive asked 14/5, 2011 at 11:7

4

I have a Model filed that returns an HTML string with line break BR tag, but How do I display that HTML on the browser ? The problem ins instead putting the line break, the Tag itself displaying on...
Subject asked 21/8, 2014 at 15:49

10

Solved

I have a view with a button. When the user clicks the button I want them redirected to a data entry view. How do I accomplish this? I should mention the views are created, tested, and functioning. ...
Brunelle asked 2/7, 2010 at 19:28

4

Solved

I need to switch between a CSS class depending if the message is read. In simple it should be like this: if (item.status == "Unread") { <tr style="font-weight:bold"> ... } else { <tr&...
Glissade asked 7/12, 2013 at 2:41

6

Solved

I am having an issue with the JavaScript that is produced by ASP.NET MVC's System.Web.Helpers.Json.Encode() if the model includes a DateTime property. My Model: public class MyViewModel { public...
Vita asked 26/6, 2013 at 22:7

1

Solved

In my old ASP.NET web app, I coded an HTML helper to get access to the context of the controller executing the current view by accessing ViewContext.Controller: public static string GetControllerS...
Aristocratic asked 30/8, 2019 at 11:18

3

Solved

How to add class attribute for following situation (Using ReturnUrl only): @using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl })) { } I want something like this: @using (Html.BeginForm...
Measurable asked 21/12, 2012 at 3:52

5

Solved

I have a list of enums that I am using for a user management page. I'm using the new HtmlHelper in MVC 5.1 that allows me to create a dropdown list for Enum values. I now have a need to remove the ...
Teasel asked 25/11, 2014 at 17:28

© 2022 - 2024 — McMap. All rights reserved.