All Questions
Tagged with razor html-helper
498
questions
0
votes
1
answer
40
views
Does not exists in the given context
enter image description here
$.each(data, function (i, item) {
var stdid = item.Studentid;
var rows = "<tr>"
+ "<td class='prtoducttd'>" + item.Studentid + ...
0
votes
1
answer
351
views
Display Each Element From Array Using HTML Helper in C#
This is probably a very simple problem, but I am extremely new to C# / MVC and I have been handed a broken project to fix. So it's time to sink or swim!
I have an array of strings that is being passed ...
0
votes
0
answers
62
views
Html.ActionLink creating unexpected host address in Razor Page
Creating an AnchorTag in a Razor page table. The table cell with the OrderNbr needs to be a link to the website (e.g. https://host/main?OrderNbr=012345) with the order using the routevalue of the ...
0
votes
1
answer
261
views
Do All HTML attributes require a @ in ASP.NET MVC
I am working on a project that declares html attributes as @class = "className" or @id = "ID" however for this form control it does not happen:
@Html.CheckBoxFor(Model => Model....
1
vote
1
answer
297
views
How to create custom HtmlHelper for nullable Boolean radio button group in .NET Core
Trying to make a custom MVC control
[Display(Name = "Do you agree?")]
[Required]
public bool? Agree { get; set; }
0
votes
0
answers
65
views
Html Helper in partial view, only adding my script once
I have a view that is rendering multiple partial view inside as follow :
<div>
<table class="EditTable">
@foreach (var view in Model.ViewsToRender)
{
...
0
votes
1
answer
64
views
Getting @Html.DropDownList or select value
I need to get the value of my @Html.DropdownList for adding a condition by its value. But I don't know how can I get that. What should I do?
Here's my code. help me for this...
@using (Html.BeginForm(&...
0
votes
1
answer
377
views
Display IP ADDRESS in Html.Label using Viewdata
I am trying to pass IP address to my view using ViewData but it isn't displaying correctly. Below is my coding for label:
@Html.Label(ViewData["CREATED_LOC"].ToString(), new { @class = "...
0
votes
1
answer
1k
views
No opportunity to override name attribute for @Html.TextBoxFor in asp.net core 3.1
We are migrating our project from .net Framework 4.72 to .net core 3.1.
I have next html helper code:
@Html.TextBoxFor(Model => Model.Property, "{0:0}", htmlAttributes: new { maxlength = ...
0
votes
1
answer
64
views
CheckBoxFor Nullable Boolean Serialization
I have a nullable boolean in a class that I'm using for a model for a partial view. By doing the following:
@Html.CheckBoxFor(p => p.policies.is_a_company.Value, new { @class = "form-control&...
1
vote
2
answers
3k
views
HtmlHelper does not contain definition for “Action”
i am trying to use Html.Action() to render partial view(GetNotificationpartial) inside layout.cshtml...but got this error , how can i fix this error
<li class="dropdown">
...
0
votes
1
answer
79
views
Html.DropDownListFor : how to show all options by default
Is there a way to show all options in the Select created by the helper Html.DropDownListFor ?
I was searching for the event triggered when you click on the select to show all options to manually ...
1
vote
1
answer
359
views
Unable to add styles and place holder to @Html.TextAreaFor
I am using the following html tag:
@Html.TextAreaFor(Model => Model.TaxID,
new {styles = "width:30%; border-color: black; maxlength: 9" @placeholder = "xxxxxxxxx"})
I am unable to retrieve none ...
-1
votes
1
answer
189
views
foreach in Razor Syntax in SubscribeEventMapping
This is the error.
I'm trying to get data from DB using MVC Controller returning to View.
Error CS1579 foreach statement cannot operate on variables of type 'SubscriberEventMapping' because '...
-1
votes
1
answer
137
views
In an MVC5 controller how do I create an IDictionary or routeValueDictionary for an HtmlHelper's htmlAttributes or routeValues?
MVC5
The ultimate objective is to create the view's links in the controller because they change based on program logic.
The following link compiles and runs:
Dim myLink = HtmlHelper.GenerateLink(...