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

DropDownListFor with select2 is very slow

I work with C# and when to list very users in dropdown I should wait for a long time. Are 11.100 users to list. I try use the DropDownListFor with select2 for the can be possible search: @Html.DropDownListFor(m => m.IDUser, ListUsers(), new { @class…
natielle
  • 380
  • 3
  • 14
0
votes
1 answer

HTML Helpers DropDownList On change Jquery Event filter another DropDownList? MVC Example attached

i have select option like, I was able to generate it and was working fine. But If I try to submit it using the parameters: Name = null ObjAOption = [1,2] // assume I selected 2 options in my…
Josh
  • 223
  • 1
  • 6
0
votes
1 answer

MVC 3 using a Model inside a Razor layout page?

Is it possible to use a Model inside the layout page? For instance, we have a a model that contains several forms to be rendered onto the page. One form is a search form used to search our site and we would like to add that to the layout page. Now…
Patrick
  • 5,442
  • 9
  • 53
  • 104
0
votes
1 answer

Custom helper. How to get URI from an action method name and controller

I'm writing my own helper and it needs to get a path as a parameter. I can of course refer to it directly passing a string or using Url.Action(). But what if I want to generate fully qualified URI inside of my helper method using action, controller…
iLemming
  • 34,477
  • 60
  • 195
  • 309
0
votes
0 answers

unicodeEncoderError when I am trying to beautifulsoup a website

encodingerror I am trying to scrape the mentioned website on the pics but I keep getting this error, and I am a total noob in programming so any help would be greatly appreciated
0
votes
1 answer

HTML helper Action Link

I am getting below compilation error : Compiler Error Message: CS1929: 'HtmlHelper>' does not contain a definition for 'ActionLink' and the best extension method overload 'AjaxExtensions.ActionLink(AjaxHelper, string, string,…
0
votes
0 answers

Environment Tag Helper won't work aspnet core 3.0

I have the following snippet in a view:
Testing Environments
I have the following in my _ViewImports.cshtml file @using Microsoft.AspNetCore.Mvc.TagHelpers I have no…
dstewart101
  • 1,084
  • 1
  • 16
  • 38
0
votes
0 answers

Text is not displayed in chrome, but working in IE

I am trying to create a table dynamically in a web page and using ASP.NET to do so. Below is the sample code I am using. The same code is working in IE, but not in Chrome. trPropertyHeader.CssClass =…
0
votes
0 answers

ASP.NET MVC Multiples Models/Helpers in a same View

I would like to use 2 models in a same view. I use 2 HtmlHelper and this work perfecly but I don't know how to bing data to my HtmlHelper. In my view : @{ Models.Users.EmailChangeRequest EmailRequest = new…
Mayzz
  • 116
  • 1
  • 9
0
votes
1 answer

How to make data type of object accept bool, string and object in razor view

I have a model of question list which of type BOOL, STRING and OBJECT. whenever i select any response it has to bind the value to the model and while submitting the form it has to post the value. Model.cs public enum QuestionType { bool, …
Vidhya
  • 1
0
votes
0 answers

How do I pass CheckBox values from a view to a controller using @Html.CheckBox?

I need to display 6 types of tests on my view and allow the user to check as many tests as they'd like to complete. I will then need to send their response to my controller so I can add that information to a database using the entity framework. my…
Adam M
  • 1
0
votes
1 answer

MVC - Render Value and Name Attribute

Is there a HTML helper in MVC that will render the value of the property with the name attribute. For example,
Hello World
I'm currently using 'Display for' which just renders the text ... public string…
japes Sophey
  • 487
  • 3
  • 8
  • 26