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

Secure password is now only allowing the encrypted password

so I created this login in form using HTML and PHP. I used md5 encryption to encrypt the password on the database. Now when a user tries to login the database is only accepting the encrypted password. What is the best course for this? $user_name =…
0
votes
1 answer

Custom HtmlHelper with EditorFor Template

I have an EF model that I'm passing into the views to Create and Edit. I have a field that is a string (varchar(100)) that is meant to store a delimited list of potential values. That list should be populated by a checkboxlist. I know how to get my…
Jason N. Gaylord
  • 7,910
  • 15
  • 56
  • 95
0
votes
1 answer

Strange problem with ASP.NET MVC DropDownFor

Hi, I have the following in my view :
"> <%: Html.DropDownListFor(model => model.LS.L1, Model.LS.Location1List, "-- Place --", new { @class = "dd1" })%> …
Banshee
  • 15,376
  • 38
  • 128
  • 219
0
votes
1 answer

Using ViewBag with @Html.CheckBoxFor rather than "plain"

Having already used @Html.CheckBoxFor within a View, I plan to use with the former Tag Helper in conjunction to ViewBag within the same View to circumvent few errors (e.g. variable definition): MODEL public class test { public int…
dark.vador
  • 619
  • 1
  • 6
  • 25
0
votes
3 answers

Simple Razor question regarding Html.Editor helper (MVC3)

Basically, I have a table with multiple editors like this:
@Html.EditorFor(x => x.Random1) @Html.EditorFor(x => x.Random2)
@Html.EditorFor(x=> x.Random3)
Now, my…
Kasper Skov
  • 1,954
  • 10
  • 32
  • 53
0
votes
0 answers

.NET MVC HtmlHelper extension problems

.NET MVC HtmlHelper extension I have this custom HtmlHelper extension, it gets a lambda expression that must be a child collection of the model, (for example model.childs), and a string that contains the name of a property of the collection items…
patsy2k
  • 471
  • 2
  • 8
0
votes
1 answer

How to display error messages in fields of a form that are not valid?

I'll try to be brief. This is my problem: In my asp.net project I have a form page who sents data to a MongoDB. It works well when I fill in all the form. But, now I'm trying implement some validations on the form to warning the user that he forgot…
Thomas
  • 1
  • 2
0
votes
2 answers

Merge POST parameters in single property in my view model

In my registration FORM, I have to allow the user to put his date of birth. It is a requirement, that I show a SELECT for the day, a SELECT for the month and a SELECT for the year. I have worked out a Html helper extension that creates that schema,…
vtortola
  • 34,709
  • 29
  • 161
  • 263
0
votes
1 answer

MVC dropdownlist - bind multiple property from items

I have Institutes collection. it contains ID, Description, Name, Age etc properties. I can get ID and Description after selection. but how to get other properties (e.g. Name) based on selection. here, I need "Name" property as well. I have below…
SSD
  • 1,041
  • 3
  • 19
  • 39
0
votes
1 answer

Redirect to same page after Login in Asp.net core mvc

I want to redirect to same page after Login. Login.cshtml @using (Html.BeginForm("Login", "Account", FormMethod.Post, new { returnUrl = Request.RawUrl })) Login Controller public ActionResult login(string returnUrl) { //If login successful return…
user15844940
0
votes
1 answer

Label with HTML content

How may I create a strongly-typed label with HTML content inside in MVC3? I have checked the code in the w3c validator and it seems to be valid, is there a way to do it? Thanks.
vtortola
  • 34,709
  • 29
  • 161
  • 263
0
votes
1 answer

how to toggle a section whilst hiding the others using javascript?

I found a code snippet from someone else explaining how to toggle on an element whilst hiding the other, although it was made with jquery. I need to have the same code in pure Javascript for my exam. Is there anyone that knows what my issue is now…
0
votes
0 answers

Html Data Attribute Not Properly Translating To "success" Portion of "jquery.get()" in HtmlHelper

I'm trying to create an HtmlHelper for jstree nodes. Part of my objective is to encapsulate the "select_node" logic into a re-usable format. For our purposes, we can expect to use a jquery "GET" which will call into an MVC controller method. That…
Seraph812
  • 397
  • 3
  • 7
  • 17
0
votes
2 answers

Can ASP.NET MVC Html Helpers work with descendant classes?

If a partial view is based upon a base class, is it possible to check if it is a descendant class and if so, use the descndant class' properties within the Html helpers (LabelFor, EditorFor etc.)? @model ProjectX.Models.VehicleModel
John
  • 57
  • 1
  • 4
0
votes
0 answers

What is a appropriate way to show checked radio button in edit view ASP.Net MVC

The value of Online,Tele and Physical in DB with int datatype. In Edit View i want to checked the radiobutton which have the value 1 in db. The AppointCat is random property in model. I used this long if else condition in my Edit View. How i improve…
Burair abbas
  • 77
  • 1
  • 7