asp.net-mvc-viewmodel Questions

6

Solved

Say you have an ASP.NET MVC project and are using a service layer, such as in this contact manager tutorial on the asp.net site: http://www.asp.net/mvc/tutorials/iteration-4-make-the-application-lo...
Moth asked 8/6, 2010 at 23:45

5

Solved

I am changing a create form to become a modal dialog and jquery Unobtrusive validation stops working and don't know how to fix it. Index.cshtml has a link to trigger a modal dialog. <a href="#...

4

Solved

I will try to get straight to the point. I had some help building a ViewModel here on StackOverflow. It worked fine in MVC 4 but now that I am converting the application to MVC 5 it is not working....

3

Solved

Hello as the title states I would like to create a form with 2 columns. In the end I want it to look like this jsfiddle I've been playing with. however by looking at the code I don't believe this i...
Grip asked 27/3, 2014 at 18:44

3

We currently use DTO for Web API request and response and use ViewModel to pass data to the View in MVC Currently, we have: DTO as a separate project ViewModel is inside the UI project ...
Latimer asked 29/5, 2018 at 5:30

3

Solved

I have two view models: public class ParentViewModel { public Id { get; set; } ..... public ChildViewModel Child{ get; set; } } public class ChildViewModel { public ChildId { get; set; } ...
Blush asked 16/1, 2014 at 20:51

1

Solved

Following viewmodel used in a view is supposed to display a StartDate as, say 9/30/2015. But it is displaying as 9/30/2015 12:00:00 AM. How can I make it display without time while using DataAnnota...
Declarative asked 27/7, 2017 at 21:49

4

Solved

I'm passing a ViewModel back from my View to the Controller via a form HttpPost. However, the values returned are always NULL. ViewModel public class vmCompanyAddress { public StatelyTechAdmin.M...
Anomie asked 13/5, 2014 at 19:21

1

This is a field located in my viewmodel: [Required(ErrorMessage = "Email is missing."), EmailAddress(ErrorMessage = "Email is not valid.")] public string Email { get; set; } (EmailAddress is fro...

4

Solved

I have a strongly-typed partial view whose model contains a property with the same name as the parent page's view model. For some reason the rendering engine is rendering the parent view model valu...
Lautrec asked 7/8, 2012 at 10:16

1

I've been doing tutorials and trying to learn best practice when it comes to MVC development. The design I'm using below comes from Pro ASP.Net MVC5 by Apress/Adam Freeman. So far, everything is co...
Steelmaker asked 28/6, 2014 at 17:15

5

Solved

I'm trying to using a PagedList in my ASP.Net application and I found this example on the Microsoft website http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/sorting-filtering-and-...
Expunction asked 4/8, 2014 at 18:37

5

This is more of a generic architectural question: I'm trying to decide if it's ok for my programmers to use "ViewBags" to pass data to views that already accept Models. My personal preferen...
Clipclop asked 12/2, 2014 at 1:42

3

Solved

To make a validation with a Regex, I usually do: // In my ViewModel [RegularExpression("MyRegex", ErrorMessageResourceName = "MyErrorMessage")] public string MyField { get; set; } And the HTML h...
Plicate asked 28/4, 2014 at 9:19

11

Solved

From this question, it looks like it makes sense to have a controller create a ViewModel that more accurately reflects the model that the view is trying to display, but I'm curious about some of th...
Bilingual asked 19/3, 2009 at 21:48

1

Solved

I am building an ASP.Net MVC application using a ViewModel approach to keep my domain entities separate from the "models" used by my UI. I am using the following convention for naming my ViewModel ...
Landrum asked 15/9, 2013 at 21:43

5

In MVC in the controller you should get the Model from DB and convert it to a ViewModel before sending it to the View. Typically using something like Automapper. My question is, if you need ...
Cacique asked 18/5, 2014 at 14:55

2

Solved

I'm fairly new to the using ViewModels and I wonder, is it acceptable for a ViewModel to contain instances of domain models as properties, or should the properties of those domain models be propert...
Virnelli asked 14/5, 2014 at 8:0

5

Solved

In my ViewModel there is a property that needs a 2 line label but when I place a <br /> in the DisplayName attribute the HTML code is printed to the page instead of being interpreted as a lin...
Polysepalous asked 12/3, 2014 at 14:26

1

Solved

So, I have an issue with a controller/view/viewmodel. It's similar to this issue I think. Basically, I have a viewmodel that I send to a view from my controller. There are items that display and th...
Rembrandt asked 6/12, 2013 at 15:5

2

Solved

I just started learning about ViewModels in ASP.NET MVC. So, I thought of implementing a sample example as below: Business Entity public class AddModel { public int a { get; set; } public int b...
Scarface asked 2/12, 2013 at 8:24

3

Solved

I have two lists that i want to return to the view, 'added' and 'removed'. However currently i can only return either the 'added' or 'removed'. How can i return both in one object? I am very new to...
Virginium asked 7/11, 2013 at 15:7

3

Solved

I am following along with the music store example to try learn ASP.NET MVC. I'm creating a cookbook application. I have created my viewmodel that looks like this: namespace CookMe_MVC.ViewModels...
Alcibiades asked 27/1, 2011 at 6:16

3

Solved

I am having an issue that when I post to a controller I lose binding and everything in my view model is NULL. Here is the code I am using: View: @model ArticleCategoryVm @using (@Html.BeginForm(...
Granicus asked 5/3, 2013 at 15:34

5

Solved

I have an asp.net-mvc website with the following folders: Controllers Scripts Views ViewModels Models DomainModel I now want to access a lot of this business logic and database access code and ...

© 2022 - 2024 — McMap. All rights reserved.