Questions tagged [asp.net-mvc-views]

A view is a standard (X)HTML document that can contain scripts. You use scripts to add dynamic content to a view.

To make it easier to add content to a view, you can take advantage of something called an HTML Helper. An HTML Helper, typically, is a method that generates a string. You can use HTML Helpers to generate standard HTML elements such as textboxes, links, dropdown lists, and list boxes.

167 questions
4
votes
3 answers

MVC5 view drop down list

In a C# MVC5 Internet application view, how can I display a dropdown list for a user to select a list item that is populated from a View Model list? Here is the ViewModel code: public class MapLocationItemViewModel { [Editable(false)] public…
Simon
  • 7,991
  • 21
  • 83
  • 163
4
votes
1 answer

Multiple-Add in a single View, ASP.NET MVC

I'm trying to add multiple items of the same type at once in a single View, while giving the model. @model List For the view, It renders, when I post back, the model is null, even though the form data is sent correctly but for some reason the…
Rami Sakr
  • 372
  • 1
  • 14
4
votes
3 answers

Created a new view in MVC 5, opening the new view results in HTTP 404

When I open the default MVC views(index and create) it work fine, I can add data and get data from the database. When I create a new view it don't work. It gets Http 404. This is even if I duplicate the create view, only with a different file…
Bjorn
  • 723
  • 2
  • 11
  • 29
4
votes
2 answers

Having to repopulate viewmodel when modelstate is invalid due to not sending all data in such as drop down box list

In my project I create a survey, I link this survey to a company and select users to participate. I select survey template, add extra questions and sets information about the survey such as start and end date. All in all the result is a complex view…
4
votes
1 answer

how to pass data from View to Controller using ajax get or post in mvc with parameters

I am trying to pass data from View to Controller Action Method using ajax as follows:- I have Membership instance of user which I passed in from another controller to this view below using viewbag somewhat like this ViewBag.MyUser = MyUser; Now I…
4
votes
1 answer

mvc httppost href parameters

I'm currently working in ASP.NET MVC 4 with EF 4.0. I have an unordered list with listitems. Each listitem contains a name and address and is clickable. Now I want to make it so that, when I click the listitem, I go to a new View. This view is…
3
votes
2 answers

How to bind Dictionary type parameter for both GET and POST action on ASP.NET MVC

I want to define a view which displays a list of label and checkbox, user can change the checkbox, then post back. I have problem posting back the dictionary. That is, The dictionary parameter for the post method is null. Below are action method for…
Pingpong
  • 7,681
  • 21
  • 83
  • 209
3
votes
0 answers

I am getting a Error as Unable to preventDefault inside passive event listener due to target being treated as passive

I am having a Asp.Net MVC application I am getting below error every time, especially when there is a list or a table. I tried to fix it but unable to figure out a solution. Can anyone help me please? Script Error as in Google Chrome DevTool is as…
3
votes
3 answers

Visual Studio does not deploy ASP.NET Core views when they are in an area

Setup Visual Studio 2015 (with Update 3 and latest hotfix as of today) .NET Core SDK (preview 2) installed Create a new ASP.NET Core project Add a new area, register it and add views in it Deploy it to IIS using web deploy in Visual Studio Part of…
3
votes
1 answer

How can I get a tag in a view and set some InnerHtml to this tag?

I am coding a MVC 5 View, and I would like to set the InnerHtml of an HTML element. Here is the HTML code that I would like to add some additional HTML to: