All Questions
Tagged with razor asp.net-mvc
16,936
questions
1
vote
1
answer
33
views
How to conditionally render style attribute in Razor template without causing NullReferenceException?
I am working on a templating project using C# and Razor Engine (Razor Templating Engine). The objective is to create React code using my own JSON definition.
My AppDefinition.json looks like this when ...
0
votes
0
answers
30
views
ASP.NET MVC datepicker doesn't show calendar
I'm trying to add datepicker, however when I try to use @html.TextboxFor, the calendar is not popping up. As for EditorFor to input="date" options, they show mm/dd/yyyy format when I need dd/...
0
votes
0
answers
33
views
How to autopopulate fields from razor view page
I have already created a view that displays data in a razor page (5 columns)
studentFirstName, StudentLastName, StudentId, CourseId, Grade
It also displays a button (instead of default Edit link) ...
0
votes
0
answers
35
views
Issue with RadioButtonFor in Index.cshtml - ASP.NET MVC 5
In my Index.cshtml in ASP.NET MVC 5, I have the following code and it works fine.
<div>@Html.DisplayNameFor(model => model.IsEnrolled) Enrolled </div>
But, if I replace the same code ...
1
vote
0
answers
38
views
Converting UTC time in model to Local time in view
I have a C# model that includes a list of items, and each item has a DateTime property containing a time that is represented as UTC.
I need to render those times to the UI, which is a cshtml page, and ...
0
votes
2
answers
86
views
How to update a table and refresh the partial view
I am using ASP.NET MVC and have a HomeController, model, and view. I am trying to create a search filter, where the user can type in some characters, click submit, and filter a table (in a partial ...
0
votes
2
answers
56
views
Form in foreach in Razor view: Validation is shown to all the elements
Consider the following Razor code
foreach(Person p in Model.Persons){
<form>
@Html.TextBoxFor(m => p.Name)
@Html.ValidationMessageFor(m => p.Name)
@Html....
0
votes
3
answers
94
views
How to pass value from controller to view and display it in a text field or label
I am a bit stuck trying to figure out on how to show the value of a field model.SumValue which I am calculating in the controller class in a input field or a label.
Controller class -
public ...
1
vote
0
answers
117
views
Navigation to file on parameter with Custom Helpers for cshtml
I have a custom helper @Url.Content("./customfolder/typescript.ts", ContentExtension.ToJs) that alters the file and directory. But I lose the functionality to navigate to the original file.
...
0
votes
0
answers
39
views
Cannot see any changes i made in the cshtml file on browser
I'm a newbie in programming (17 y.o), and I am currently struggling with ASP.NET. When I create a .cshtml file and try to test it in the browser, I see the default interface that Microsoft provides. ...
1
vote
2
answers
67
views
InvalidOperationException: The view 'AddValue' was not found. Partial View not found when submitting form data
I'm trying to insert data into two table from a single View Page. I've used two different view model to do that. So I have to make a partial view for inserting data in second table. Now full page is ...
0
votes
0
answers
47
views
Using <select></select> to Show Name + Surname and value = "id"
I tried to show all users with role "Trainer" and choose one of them. But post an id.
select returns null.
<div class="form-group">
<label asp-for="...
-1
votes
1
answer
40
views
@await RenderSectionAsync giving "Cannot await 'method group' "
I am creating a razor application consisting of two simple user inputs and two navigation tabs with 'save' and 'cancel' button for the user inputs.
I have pasted below part of the _Layout.cshtml code ...
0
votes
0
answers
35
views
Multiple key value pairs for select and onchange
Currently I have a select with a list set in the model and an onchange to display the information according to that value. An update has been requested to have another section of the Model added. I ...
0
votes
0
answers
22
views
How to rename file at SFTP, using PostAsJsonAsync in C# & ASP.NET MVC
I am using C# & ASP.NET MVC, which I am not so good at. I have function already built in the system to upload files through SFTP.
It is called UploadFileAsync and takes one parameter.
Here is the ...