Hi guys,
I have a question about asp.net mvc-2 strongly typed partial views, and view models.
I was just wondering if I can (or should) have two strongly typed partial views on one page, without implementing a whole new view model for that page.
For example, I have a page that displays profiles, but also has an inline form to add a q...
I wonder - what is the best way to supply contextual (i.e. not related to any particular view, but to all views at the same time) info to a view (or to master page)?
Consider the following scenario.
Suppose we have an app that supports multiple UI languages. User can switch them via UI's widgets (something like tabs at the top of the p...
Hi,
I have a WPFToolkit-datagrid and a View-model class with a property - "SelectedGridItems"
How do I bind selectedItem property of WPFToolkit-Datagrid to my viewmodel property ("SelectedGridItems") ?
...
A short while ago I'm sure I read that is was possible to use AutoMapper to map the validation attributes from the domain model to the view model, i can't find that post any more though!
Has anybody seen any code or know if it would be possible to do this? This would give the added benefit of not repeating validation in both ViewModel +...
I'm trying to create a dummy application that maintains a list of tasks.
For now, all I'm trying to do is add to the list. I enter a task name in a text box, click on the add task button, and expect the list to be updated with the new item and the task name input to be cleared. I only want to be able to add tasks if the task name is not...
Hi,
I have a WPf Toolkit-datagrid..in my application which follows MVVM pattern.
How I can call a function in view-model if user selects a particular row in datagrid ?
...
Hi all, I've been developing an application using asp.net MVC, and I have some configurations that influences in process of render a view. For example, a user can choose (in an configuration of system) if a field should appear for a management of records in an area of the system. So, I have an class called AppConfiguration has some prope...
I have used object data provider to create instance of my view-model as below:
<ObjectDataProvider x:Key="Datas" ObjectType="{x:Type ViewModel:UserControlViewModel}">
</ObjectDataProvider>
<DataTemplate x:Key="SourceGrid">
<WPFToolKit:DataGrid x:Name="SourceDataGrid" ItemsSource="{Binding Source={StaticResource Datas},Path=SourceGridDa...
in asp.net mvc , if i shove a dictionary or an array of objects in ViewData and read that in my view compared to creating a view model class that has that same data structure, is there a performance difference or other consideration or should i expect the same response time?
...
Im struggling to understand the ViewModel part of the MVVM pattern. My current approach is to have a class, with no logic whatsoever (important), except that it implements INotifyPropertyChanged. The class is just a collection of properties, a struct if you like, describing an as small part of the data as possible. I consider this my Mod...
I may have the wrong "pattern" here, but I think it's a fair topic.
I have an ASP.Net MVC application in which it calls out to a WCF service to get back the ViewModels that will be rendered. (the reason it's using a WCF service is so that other small MVC apps may also call on for these ViewModels...only internally, it's not a publicly ...
I'm relatively new to WPF, and I'm having trouble with what I'm fairly certain is a relatively simple problem.
I have my underlying data object, a Person:
class Person
{
public string Surname {get; set; }
public string Firstname {get; set; }
public List<Address> Addresses {get; }
}
And I wish to display and edit this obje...
Hello,
I came across something strange when creating an edit form with MVC 2.
i realised that my error messages come up on form sumission even when i have filled ut valid data!
i am using a buddy class which i have configured correctly ( i know that cos i can see my custom errors).
Here is the code from the viewmodel that generates thi...
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-loosely-coupled-cs
If you have viewmodels for your views, is the service layer the appropriate place to provide each viewmodel? For instance,...
I am using ASP.NET MVC with Entity Framework POCO classes and the FluentValidation framework. It is working well, and the validation is happening as it should (as if I were using DataAnnotations). I have even gotten client-side validation working. And I'm pretty pleased with it.
Since this is a test application I am writing just to s...
Where would data annotations be more suitable:
ViewModels or
Domain Objects or
Both
I am struggling to decide where these will be more suited. I have not as yet fully utilized them but this question came to mind. From most of the examples I have seen, they are generally placed on Models and simply use the required attributes for va...
I have two properties in my view model:
//Relationship has property ReasonForEndingId
private Relationship editRelationship;
public Relationship EditRelationship
{
get
{
return editRelationship;
}
set
{
if (editRelationship != value)
{
...
I'm attempting the example from the excellent "How Do I" video for MVVM by Todd Miranda found in MSDN.
I'm trying to adapt the example for my learning purpose.
In the example, he has a ViewModel called EmployeeListViewModel. Now if I want to include Departments, should I create another ViewModel such as DepartmentListViewModel?
Th...
I am trying out ASP.NET MVC Framework 2 with the Microsoft Entity Framework and when I try and save new records I get this error:
Mapping and metadata information could not be found for EntityType 'WebUI.Controllers.PersonViewModel'
My Entity Framework container stores records of type Person and my view is strongly typed with class Pe...
With a view model containing the field:
public bool? IsDefault { get; set; }
I get an error when trying to map in the view:
<%= Html.CheckBoxFor(model => model.IsDefault) %>
Cannot implicitly convert type 'bool?' to 'bool'. An explicit conversion exists (are you missing a cast?)
I've tried casting, and using .Value and neither wor...