viewmodel

SelectList with MVC2 and custom ViewModel

I have created a custom ViewModel and one of the fields is a SelectList/DropDownlist. I wanted to use EditorForModel to display the ViewModel. All the fields work except the SelectList. I have tried a few different things and nothing has come up. I saw on one post that EditorForModel was not "smart enough" to do a DropDownList and I was ...

How to solve a HasMany relation in MVVM to show up in one row in a datagrid

Hi, i have a class Auswahl with some plain properties and a property RefFilters of type List<RefAuswahlFilter> What i want to achieve is: Display all Auswahl Properties in a datagrid with all RefFilter items in ONE row. the Problem is, the count of RefFilter is different from auswahl to auswahl object. in the past i use a datatable as...

Passing an interface to an ASP.NET MVC Controller Action method

In my ASP.NET MVC app, I have an interface which acts as the template for several different view models: public interface IMyViewModel { Client Client1 { get; set; } Client Client2 { get; set; } Validator Validate(); } So, my view models are defined like this: public interface MyViewModel1 : IMyViewModel { Client Cli...

ViewModel validation object issue with L2SQL generated model class

Hi guys, i'm having issues with implementing a ViewModel class which acts as a wrapper class around a Model class called "User" generated by L2SQL. In short, I have two instances when i have to validate against the L2SQL model. One when the user first signs up, and the second when the user logs in and edits only part of his account data....

Updating viewmodel data in controller doesn't reflect in view's input fields

I have a blogpost edit page where you can either save your edits or upload an image (multiple submits in a single form). When you upload an image, the image link gets appended to a TinyMCE content area. The fields for the form are in a viewusercontrol(shared with create page). Both the viewpage and usercontrol inherit from BlogPost so t...

WPF, read data from XmlDataProvider in C#

I want a TreeView with checkboxes and I'm trying to follow this tutorial. However, in it, he creates all his content for the TreeView at runtime. I have an XML file that I have accessible as an XmlDataProvider in my XAML: <XmlDataProvider Source="XmlData/Versions.xml" XPath="//*[count(*)=0]" x:Key="versionsXml" /> I...

The new ViewModel doesn't obsolete the ViewModel pattern in ASP.NET MVC 3, right?

In my understanding, the ViewModel pattern was designed to pass all the relevant data to View because 1) the view shouldn't perform any data retrieval or application logic and 2) it enables type-safety, compile-time checking, and editor intellisense within view templates. Since dynamic expressions are defined at runtime, does this mean ...

ASP.NET MVC Edit problem - "entity" data from controller aren't passed to the view

Hi, I'm pretty sure that I complicated my question. Sorry, I didn't know how to express myself. Situation is next : public ActionResult Edit(int id) { CreateTrainingModel editTrainingModel = new CreateTrainingModel(); editTrainingModel.Training = training.GetByID(id); editTrainingModel.Player = player.GetAll...

How to get data of EditorFor with nested viewmodels

Hello guys/girls, Here is my situation - I have two nested view models: <%=Html.EditorFor(x => x.DisplayEntitiesWithRadioboxesViewModel)%><br /> Which sit within their parent (StructureViewModel), I can populate the nested ViewModels easily and pass it through to the main View: Within the Controller - Example var moveDepartment ...

Session Per ViewModel in Desktop Application with Repository

I have been writing a WPF DESKTOP application using NHibernate, WPF, Prism and Unity Container but have a problem in terms of Session Management in Services / Repositories and how to do it cleanly through dependency injection using Unity. Having read Building A Desktop To Do-Application With NHibernate I now have a Session Per ViewModel...

Qt4 Model/View - Transforming data in View?

Here's my use case (very simplified). I have some data from DB in QSQLTableModel and I need to transform it: merge few fields into one (and display as such) or split one field into few. How and where this should be done in Model/View? Notes: I tried using AbstractProxyModel to do this, but I guess, it's suitable only for filtering or...

advice on architecting asp.net mvc applications

I've been using ASP.net MVC for about two years now and I'm still learning the best way to structure an application. I wanted to throw out these ideas that I've gathered and see if they are "acceptable" ways in the community to design MVC applications. Here is my basic layout: DataAccess Project - Contains all repository classes, LIN...

How to create a new ViewModel instance inside ViewModel class?

Say I have ViewModel class MyViewModel like: public class MyViewModel : ViewModelBase { private Person _person; public Person Person { get { return _person; } set { if (this._person != value) { this._person = value; ...

ASP.NET MVC 2 DataAnnotation: Server side validation for Required always fails on DateTime object

I am getting a strange issue with DataAnnotations in ASP.NET MVC 2which I am unable to get the hand of. I am trying to validate a DateTime In a Model Class I have defined private DateTime _dateFrom; [Required(ErrorMessage="Date is required")] public DateTime DateFrom { get { return _dateFrom; } set { _dateFrom = value; } } On...

pygtk - treeview with checkbuttons is not working

I am trying to fill a treeview with data and checkbuttons. When the treeview is displayed, checkbuttons appear but the text doesn't. I get the following error: /home/astrob/programação/pyparty/groups.py:81: GtkWarning: gtk_tree_view_column_cell_layout_add_attribute: assertion `info != NULL' failed username_treeviewcolumn.add_attribu...

Having trouble starting my very own MVC tutorial-sans web application.

I'm having trouble trying to understand what to do here. My objective isn't as simple as a regular old CRUD form to create a new entity, but rather a browse index page that will list all of the Evaluations in my database. Each evaluation is attached to a RegisteredCourse which in turn has a Teacher attached to it. Here is how I'd like...

Best practices with ASP.NET MVC view models

I ask myself how do I create a view model correctly. For instance, I have an edit view with some text boxes and a dropdownlist. Should I separate the dropdown list into a new view model or shoud the edit view have one viewmodel with a list for the dropdownlist? Or generally speaking, should I separate special input fields in separate ...

Reading models into ViewModels and other way round in MVVM - best practice -

Hello guys, I would like to get an insight into your daily work :P How do you read the Person data into the PersonViewModel ? Is it just a PersonViewModel pVM = staticHelper.ConvertPersonToPersonViewModel(person); or is there something cooler? ...

DataTemplate a ViewModel with a NOT-Empty Constructor ?

Hello, how can I datatemplate a UserControl with a ViewModel with a NON-Empty constructor ? public PersonViewModel(Person person) { _person= person; // do some stuff } Binding this in Xaml will crash as the Ctor is not empty. But as I use parent/child relations with the ViewModels I have to p...

Custom ModelBinder for IEnumerable post result in MVC

Consider this view model that uses two custom validators. It posts back to the controller in an enumerable collection. public class FormFieldViewModel { public Guid FormFieldKey { get; set; } public string Name { get; set; } // Utilize a string[] array since multiple-selection items will require this (we can assume array[0]...