Questions tagged [asp.net-mvc-viewmodel]

View model is a class, that represents data model used in specific view.

View model has many roles:

  • View models documents view by consisting only fields, that are represented in view.
  • View models may contain specific validation rules using data annotations or IDataErrorInfo.
  • View model defines how view should look (for LabelFor,EditorFor,DisplayFor helpers).
  • View models can combine values from different database entities.
  • You can specify easily display templates for view models and reuse them in many places using DisplayFor or EditorFor helpers.
497 questions
-2
votes
1 answer

WebGrid doesn´t update when binding to a ViewModel

I´m making a site using MVC 3 and razor engine. I have a WebGrid that has a ViewModel as it´s source that it´s not updating. Weird thing is that it only updates when I recompile the project, and I wanted to update it with an ajax call or at the very…
-3
votes
1 answer

iterate an object and create a new object with group by C# mvc

how do i loop through an object and create a new object in C# i have a view model eg: pViewModel { public itemFullName {get;set;} public Item Item{get;set;} } public Item{ public int itemId{get;set;} } I want to create a new object after…
1 2 3
33
34