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
0 answers

Using pagedlist with form parameters

I am using asp.net MVC 5 and Was wondering if there were any solutions out there that allowed me to use the PAGEDLIST library that can pass back input variables from the controller ALONG with passing back the .ToPagedList(pagenumber, pagesize) in…
0
votes
1 answer

Is there a way to return Json With ViewBag

Following code, is to populate IntakeName to a Html Helper DropDownlist Controller Code : public ActionResult Index() { ViewBag.intake = new SelectList(db.Intakes, "IntakeID", "IntakeName"); return View(); } View Code…
loli pop
  • 75
  • 3
  • 8
0
votes
1 answer

asp.net mvc 4 dropdown list with model isn't working

I'm converting an asp.net forms site to MVC and am having an issue with a dropdown list. Model extract: namespace adminLte.Models //then further down [Required(ErrorMessage = "Player Segment Required")] [Display(Name = "Player Segment")]…
Kearl
  • 57
  • 1
  • 4
  • 10
0
votes
1 answer

HTMLHelper does not contain a definition for 'Kendo' - Server Error

Getting below error when trying to run the app - have checked solutions online including below but to no avail :- MVC Kendo - 'System.Web.Mvc.HtmlHelper' could be…
Ram
  • 527
  • 1
  • 10
  • 26
0
votes
0 answers

@Html.ValidationMessageFor() required field displaying message when populated

I am currently using ASP.net MVC (VB). I have a model with the following property: Public Property contact_name() As String In my controller method (accepts a post request and binds various…
ZeeDawg
  • 1
  • 1
0
votes
0 answers

Html.TextBoxFor helper not binding data to model

This is a curious case I have not figure out yet and has keeping me from using tag helpers for good. I have a search form with lots of dropdown lists and options. Some of them I tried to do using tag helpers instead of HTML Helpers, since its…
0
votes
0 answers

anonymous number appended to the original selected value from HtmlHelper DropDownListFor MVC

I have an MVC razor view that captures the credit card information of the user. The month property of CC expiration date is bounded to a selectlist of type byte array. private static readonly byte[] Months = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12…
Abhi
  • 1
  • 1
0
votes
1 answer

simple_html_dom timer?

I am trying to get the contents of a webpage but the page loads in 2 times. there seems to be some kind of timer, at first it loads some content and then after 10 seconds it loads the other part of the content that have the content that i am trying…
0
votes
1 answer

Printing the web page's HTTP Headers using JavaScript

So I have a webapp that is built on the nodejs framework. At the moment I am using an NGINX Reverse Proxy that uses OIDC for authentication. Once the user is authenticated it then forwards them on to the nodejs backend. I want to grab the users…
zoomer
  • 87
  • 2
  • 4
  • 16
0
votes
2 answers

Html.Encode translating the Id into it's selected Text

So I have this on my view: <%= Html.Encode(Model.STPData.ProjectName)%> Now say instead of having the ProjectName as the string, I only had the ProjectId. How would I make this display the string of the text that the Id corresponds to? The dropdown…
slandau
  • 23,528
  • 42
  • 122
  • 184
0
votes
1 answer

Convert Y/N values of razor html checkbox in MVC

Im reading a Y/N value from my model in a razor for loop. I want to change the value from Y/N to true/false. @Html.CheckBoxFor(modelItem => (item.ReqDowngrade == "Y" ? true : false)) I keep geting this error:…
printthis
  • 141
  • 3
  • 11
0
votes
1 answer

ASP.NET MVC: HTML Helper Lambda expression fail to recognize the variable

Perhaps its my ignorance about how Razor/Html helper works, hopefully someone from this forum will be able to throw light :) I cant seem to get a simple lamda expression evaluated inside the html helper. my razor view is strongly bound to the type…
thanikkal
  • 3,326
  • 3
  • 27
  • 45
0
votes
1 answer

Creating a html helper for an object

Hi I'm really stumped on this one, then again it's one of my first html helpers (that I haven't pinched). Basically I have an object and a few options which I then want to display a a tag with a few options. my code so far is public static…
Richard Housham
  • 1,525
  • 2
  • 15
  • 31
0
votes
1 answer

Why did my custom HtmlHelpers stop working after I upgraded to MVC3?

I just finished going through this checklist to upgrade my asp.net mvc2 site to mvc3: http://www.asp.net/learn/whitepapers/mvc3-release-notes#upgrading Everything is compiling, but when I run the application I get errors in the views. Example…
quakkels
  • 11,676
  • 24
  • 92
  • 149
0
votes
3 answers

Issue with JQuery onchange() event

So I have a drop-down list and a text-box:
Group Name: <%= Html.DropDownListFor(m => m.IndicationCalculatorGroupId,…
slandau
  • 23,528
  • 42
  • 122
  • 184
1 2 3
99
100