I created two viewmodel, MyViewModel, MyViewModel2. MyViewModel2 include MyViewModel as property. MyViewModel include one entity MyEntity from EF/WCF Ria Service.
In MyViewModel2, I want to capture any item changes in MyEntity for databinding. My code like below:
public class MyViewModel : ViewModelBase
{
//....
public ...
I'm trying to create a ASP.NET MVC 2 webapp using the Northwind database following the NerdDinner tutorial, but now I keep getting the following error when trying to EDIT a product:
Value of member 'SupplierID' of an object of type 'Supplier' changed.
A member defining the identity of the object cannot be changed.
Consider adding...
We currently have a "Lookup" table which contains a set of possible choices for things like a drop down list. If this were a list of state abbreviations, LookupID would represent the set, and LookupItemID would represent the individual state.
customerID int PK
lookupID int PK
lookupItemID int PK
lookupValue string
...
Hi,
I've added WindowsMediaPlayer ActiveX to my WPF/MVVM application. Now I need the control to react to changes happening in the viewmodel (most importantly updating URL when the current selection in my collection changes). Based on Walkthrough: Hosting an ActiveX Control in WPF I have the following in my Loaded event:
// Create the i...
Hello all,
Been around here for a while but this is my first question @ so.
Scenario:
Mvc site. Viewmodels for most pages.
Each viewmodel contains models or iqueryables acquired from different repositories.
Each source is updated frequently (from outside the scoop of the site) so even if caching local it will be a lot of datasource h...
Conclusion in Images, can be found in the bottom
I'm having some trouble to get how Forms work in MVC (as I'm a WebForms Developer and really wanna start using MVC in one big project)
I took the MVC2 Web Project and add a simple ViewModel to it
namespace TestForms.Models
{
public class myFormViewModel
{
public myForm...
Hello,
I've a problem with my viewmodel.
I've a DropDownList with many translationvalues (pattern here)
In My controller - HTTPGET :
public ActionResult Edit(int id) {
int DropDownListValueId = id;
SelectListViewModel viewmodel = new SelectListViewModel(0, DropDownListValueId);
return...
I have an asp.net masterpage, and All my controllers inherit from a controller base. All my view models inherit from ViewBase. How can I have a base set of data in the master page that is populated from the base controller into the viewbase, then into the masterpage?
...
Hi,
I wanted to compare with best practices when working with an ORM or database tables in asp.net mvc. One of the major questions I have is should I instantiate the model classes directly in controller..not query the database but just use the model class to store the values.
For e.g. If I am using entity framework as model...then is i...
Hi All,
I have three tables in my db, One Parent (Product) and two childs(ProductStyles, ProductSizes) which means that a Product can have multiple Styles and Sizes.
Now What I want to do is:-
1) Shows the Products in dataGrid with having the columns Styles and Sizes and these columns should only display the Total Counts (ie how many st...
Hi
I'm new to MVVM and need a bit of help.
My application consists of a number of different windows which display controls allowing the user to edit the data in the Business layer.
At the moment, each time the user opens a new instance of one of these windows, a ViewModel structure - classes and collections mirroring the Business laye...
Looks like others have had this problem but I can't seem to find a solution.
I have 2 Models: Person & BillingInfo:
public class Person
{
public string Name { get; set;}
public BillingInfo BillingInfo { get; set; }
}
public class BillingInfo
{
public string BillingName { get; set; }
}
And I'm trying to bind this straight into my ...
A common approach for communication between 2 ViewModels is this: http://stackoverflow.com/questions/2474768/mvvm-view-model-view-model-communications
The Mediator pattern or a Messenger class. But what about 6 ViewModels in one Window?
NewSchoolclassUserControl
NewPupilUserControl
SchoolclassListUserControl
PupilListUserControl
Pupi...
I have a view model like so that is created from my validator.
public class ViewModel
{
public KeyValuePair<int, RuleType> Foo { get; set; }
public KeyValuePair<string, RuleType> Bar { get; set; }
}
My real view model has 20+ field. Once my data is validated a generic list of type ViewModel is then returned to my MVC view and...
Hello,
Do you see a better way how I can call/contstruct a Dialog from a Controller/ViewModel return data from it and set the DocumentViewModel as DataContext of the Dialog?
The problem is I can not use View first approach in the DocumentDetailWindow and its belonging UserControl because I can not set the Model to the DocumentViewModel...
Hello,
I have a CustomerListViewModel and a OrderListViewModel. In the latter I select an order to delete it or I create a new one. In both situations my CustomerListViewModel and the Messenger must register to the type IOrder:
Messenger.Default.Register<IOrder>(this, AddOrder);
Messenger.Default.Register<IOrder>(this, DeleteOrder);
...
Hello folks,
I have a ViewModel with Property int DepartmentColor. Of course I can not bind the int value to a CellStyle in XAML.
Should I make a IntToStyleConverter or should I fumble around with the Style class in the ViewModel like convert the int to a SolicColorBrush and assign it to a Style etc...
Is the latter the way to go with...
Possible Duplicate:
ASP.NET MVC - Linq to Entities model as the ViewModel - is this good practice?
Is is OK to use EF entities classes as view models in ASP.NET MVC?
What if viewmodel is 90% the same of EF entity class?
Let's say I have a Survey class in Entity Framework model. It 90% matches data required for view to edit i...
Hi
I have the model
public class PersonViewModel
{
public Guid Id { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
}
which is nested in an other view model:
public class ApprovalModel
{
[UIHint("MyDisplayTemplate")]
public PersonViewModel User { get; set; }
[Required]
...
In MVC 2 I have a user control - Partial page as below.
Model has four records
id Dtext Dtext1
1 A, A1
2 B B1
3 C C1
4 D D1
On My machine - Output is as above in the ID Order which is expected.
But after deployment output is totally bizarre something like below.
D D1
B B1
A, A1
C C1
Would like to know ...