View model is a class, that represents data model used in specific view.
3
votes
1answer
932 views
Using the ODATA $expand query option with WebAPI and a ViewModel
This question is very similar but does not give me what I need.
I am using Entity Framework 6. My database has two tables, Customers and CustomerTypes. I have created a ViewModel for each. A ...
3
votes
1answer
704 views
custom model binder with complex type MVC 3
I have the following ViewModel and i would like to create a custom binder to bind subclasses (LogOnModel, ChangePasswordModel).
public class LogOnViewModel
{
public string NextStep { get; set; }
...
2
votes
1answer
376 views
MVC create a view model from multiple domain models distantly related
I have been searching for a way to join 2 distantly related domain models into one view model with no luck.
I am working on an existing application and have been asked to add a field to a result of ...
1
vote
1answer
95 views
MVC5 EF6 How to add confirmation screen with additional authentication before submitting data
Developing a new MVC5 project. I have my scaffolding in place for CRUD functionality but there is a requirement that when data is inserted or updated, an e-signature is required. Before data can be ...
1
vote
1answer
4k views
How to pass model to partial view
I have two view models:
public class ParentViewModel
{
public Id { get; set; }
.....
public ChildViewModel Child{ get; set; }
}
public class ChildViewModel
{
...
1
vote
1answer
374 views
MVC 3 viewmodel properties
I have a question regarding organization of properties in viewModel. As far as I understand the viewmodel should be as simple as possible, and the main thing that it should do is bind data to view.
...
0
votes
1answer
20 views
Kendu Upload is not passing dropdown value
When I use Kendu Upload control I can't get my dropdown value to the controller. When I don't use Kendu upload and just a regular input and button, the value is passed to the controller. I'm ...
0
votes
1answer
42 views
create CheckboxFor from List in View Model
My View Model Class is
public class StudentQuestions
{
public int StudentId{ get; set; }
public int FormId { get; set; }
public virtual ICollection<Questions> ...
0
votes
1answer
47 views
File uploading with KnockoutJS and ASP .Net MVVM
Does anyone have experience with ASP .Net MVVM and Knockout JS. In my application, I need to allow users to upload files. I find it difficult to find examples or any documentation online that will ...
0
votes
1answer
274 views
Populate mvc dropdownlist based on user role
I'm adding a dropdown list to the view on my MVC project. The dropdown list will be populated based on the user type; a user can create a new user with the same or a lower access level. The access ...
0
votes
1answer
195 views
MVC 4 Passing View Model to controller - Using JavaScriptSerializer to Deserialize complex JSON Object
I am trying to Deserialise a JSON object in to a strongly typed .net object/Type. This is the object I want to create from the JSON
[Serializable]
public class CartItem
{
[Key]
public int Id ...
0
votes
1answer
193 views
How to validate against a Model's metadata through a custom ViewModel?
I'm working on a webapp using ASP MVC. I'm building a page to edit a user's data (model USER, view ModifyUser).
I have a model with validations in this manner:
...
0
votes
1answer
103 views
MVC ViewModel not updating with Internet Explorer 11
I have a simple form that is working just fine with Firefox 26 (latest version as of 12/26/2013) but when I run this form with Internet Explorer 11 I am not seeing the values from my two jQuery ...
0
votes
1answer
186 views
Viewmodels and PartialView problems MVC C#
I am fairly new to C#/MVC and are stuck understanding some propably basic stuff so maybe a helpfull soul or two can help me out.
What i am trying to work out is the concept with Viewmodels and ...
0
votes
1answer
71 views
Tab in edit mode in MVC4
I am trying to Implement Tab control in MVC 4 , I want similar like Nopcommerce
if you login in admin -->sale -->Order -->View
I am not able to understand how to do this ?
Url is not changes in ...
0
votes
1answer
209 views
How to add text boxes in MVC when binding a view to an IEnumerable?
I am working on this project. We are using EF and backside data models. We are mapping them to viewmodels that have the same property names. This has created 4 separate view models, which I'm ok with. ...
0
votes
1answer
258 views
validate a field in the viemodel before submit mvc
I have a viewModel that implements custom validators:
public class RegistrationViewModel
{
#region country
public int CountryId { get; set; }
public List<SelectListItem> Countries ...
0
votes
1answer
173 views
Should I have each ViewModel for each entity in my ASP MVC project?
I have read many by many solution but i can't understand deeply about what or when i use View Model?
For example, when i have a Register form for User to register, i want to hava an field Confirm ...
0
votes
1answer
463 views
Return null value after page PostBack in Mvc4
I want to create Invoice Create View.
My viewModel as follow:
public class InvoiceCreate
{
public IEnumerable<InvoiceItem> InvoiceItems { get; set; }
public ...
0
votes
1answer
153 views
Can a 'ViewModel' hold 'DomainModel' type property
In asp.net MVC 4, I have 2 DomainModels
Product
Order
and a related ViewModel
OrderDetailsViewModel
In my "OrderDetailsViewModelMapper" mapper file I am manually mapping ...
0
votes
1answer
127 views
Reuse DisplayAttributes with view model properties
Is there a way to use the DisplayAttribute values of an entity within a view model?
public partial class Catalog
{
[Display(ResourceType = typeof(Resources), Name = "ID")]
public string ID { get; ...
2
votes
0answers
1k views
ASP.Net MVC File uploading ViewModel Binding
So I'm fairly new to ASP.net MVC and have been trying to make a fileuploader, but I can't seem to get my uploaded file bound to my viewmodel. I'm trying to apply validation to the uploaded file ...
1
vote
0answers
382 views
MVC4 Get listboxfor Text & Value properties
In My MVC4 EF5 App i'm using 2 listboxes. each listbox is bounded to a List property of my view model.
i would like to get all listboxes items (and i mean all SelectedListItem - Selected, Text, ...
1
vote
0answers
332 views
ASP.NET MVC ViewModel is null on Post Back - sometimes
depending on my input in an HTML form (6 or 6.5 - or in general, integer VS float) I get or don't get the following exception (it works with int and doesn't work with float):
The model item passed ...
1
vote
0answers
265 views
ViewModel returned by View (PartialView) is empty
Please help me to understand why my view model is returned by view as empty. I tried to find solution in google, but vast majority of advices is to add hidden. But for me adding Html.HiddenFor didn't ...
0
votes
0answers
25 views
MVC4 DropdownFor not submitting selected value
ViewModel
namespace VendorFinancing.Web.Models
{
public class CreateApplicationViewModel
{
public Application Application { get; set; }
public List<Equipment> ...
0
votes
0answers
6 views
One View, pass in different ViewModels depending on validation requirements
Is it possible to have one View and then pass in different ViewModels at different times?
What I want to do is say have an Address partial view and then pass in a different Viewmodel depending on ...
0
votes
0answers
53 views
Child element validation message prevents validation message on parent list
Does anyone know why in MVC3 a validation error on a child list element of a view model causes another different validation error on the list property of the view model to be suppressed?
This may be ...
0
votes
0answers
46 views
List of View Model as Child of Parent Model
I'm working on an MVC project and have a question about the best way to use a view model from a child class. The child class becomes a List in it's parent class. I'm having some trouble figuring out ...
0
votes
0answers
40 views
MVC: pass IEnumerable inside ViewModel into EditorForModel() template?
this is my very first question here, so Id greatly appreciate if I could get some helps.
Well...I have the code below where i send IEnumerable into View, the EditorForModel render the whole list to be ...
0
votes
0answers
297 views
MVC ViewModel example
I've been doing tutorials and trying to learn best practice when it comes to MVC development. Learning on my own can be tuff sometimes. The design I'm using below comes from Pro ASP.Net MVC5 by ...
0
votes
0answers
22 views
Layering your Application - How to structure Models of the different concerns
iam rebuilding one of our projects in ASP.NET MVC 5. In the old Projects we're using the old ASMX webservices which are handling our database calls directly. The (Webforms) websites are consuming this ...
0
votes
0answers
72 views
ASP.NET MVC ViewModel with IEnumerable Property
What I am Attempting
I am trying to bind my ViewModel to my View which contains a Customer Name and a list of Contacts to reach that customer. Once the view is populated I also want the user to have ...
0
votes
0answers
72 views
JQuery not working in view model
I have an MVC project that uses some JQuery that works fine on my Create page. I am trying to create a view using a View Model but when I do the JQuery doesn't work. Any idea why it wouldn't be ...
0
votes
0answers
11 views
Getting Action Name from ViewModel class
public class CompanyValidator : AbstractValidator<CompanyViewModel>
{
public CompanyValidator()
{
RuleFor(x => x.ID).Must(BeUniqueName).WithMessage("ID already ...
0
votes
0answers
28 views
How to Group Radio Buttons in EditorTemplate for collection containing Radio buttons AND checkboxes
My Models and View Models
public class Component
{
public int ComponentId { get; set; }
public string Description { get; set; }
public bool Selected { get; set; }
}
public class ...
0
votes
0answers
53 views
ViewmodelBuilders for viewmodels with properties to other viewmodels
I'm using a ViewModelBuilder-class to map my models to ViewModels.
Problem is, when I try to build viewmodels for the Projects property I use a viewmodelbuilder for that too and THAT ...
0
votes
0answers
173 views
Getting data from viewmodel in cascaded controls for absolute beginners
I have 3 tables in a database, connected with relations.
With the help of the wizard, I imported that tables into an edmx model and created a view model.
It looks like this:
public class ...
0
votes
0answers
170 views
The parameters dictionary contains a null entry for parameter 'lanID' of non-nullable type 'System.Int32' for method ' EditCategory(Int32, Int32)'
Hello as I'm so new to MVc with ViewModel and Onion Infrastructure I got the following error:The parameters dictionary contains a null entry for parameter 'lanID' of non-nullable type 'System.Int32' ...
0
votes
0answers
66 views
how to use automapper for delete action in mvc?
I have used domain models in Views before. Now i just started creating ViewModels and used automapper to map the domain models to view models. I am new to automapper and have read few tutorials about ...
0
votes
0answers
128 views
Angularjs full cache / context preservation
I'm new to Angularjs and liking the general idea. Some time ago I build a "SPA" application with just simple javascript caching of IFrames. The result was that the full context of the iframe was ...
0
votes
0answers
15 views
Is there an easy way to map different objects with the same name?
I have a database model and a view model... the variables are mostly the same (properties).
I want to save time typing and let visual studio figure out that I want to save "name" on the database ...
0
votes
0answers
59 views
MVVM View bound to a Viewmodel passing information to a controller via ajax post
I'm new to MVVM and am finding it difficult to pass the desired information from my View to my controller, which then calls the ViewModel method and makes changes to my database.
My View:
...
0
votes
0answers
71 views
View model, ajax and error handling dilemma
We have a moderately complex MVC app that talks to a WebApi based data service to retrieve the data. To reduce the code replication, we have decided to use the same domain models in both MVC layer and ...
0
votes
0answers
59 views
Adding a custom folder inside viewmodels folder in Hot Towel Template
I am using Hot Towel template in my current MVC application. I have few viewmodels directly with in "viewmodels" folder. I was wondering if I can add a custom folder inside viewmodels folder and ...
0
votes
0answers
30 views
Display content from various sources
What is the best way to display content from multiple sources(websites)? For example, Display news from various news sites to your site. Not links but actual content. I want to automate this process ...
0
votes
0answers
324 views
DropDown list issue in knockout js asp.net mvc 3
I have the following problem. I'm developing web application on asp.net mvc and using KnockoutJS in one of views. I have the following viewmodel
public class ExampleViewModel
{
public ...
0
votes
0answers
149 views
How do you bind a nested viewmodel list with a custom modelbinder?
I'm trying to bind a viewmodel with a dynamic list of nested viewmodels. I figured out on how to bind 1 viewmodel that is nested. But how do I bind a list of them?
My classes:
public class ...
0
votes
0answers
253 views
MVC 4 ViewModel LINQ
I'm new to MVC 4/EF/LINQ. The primary issue concerning the data is that a person over time can have multiple last, first and middle names. So, for instance, the last name entity has a foreign key ...
0
votes
0answers
138 views
using viewmodel and saving the data to respective tables
Im new to asp.net mvc. I've created the following models :
public class Unit
{
public int UnitId { get; set; }
public string Name { get; set; }
public string Alias { get; set; }
}
public ...