I've already started similar topic, but still didn't find final solution...
So here I am with new one :) ... I'm developing NerdDinner from scratch and now I came to point where I define DinnerViewModel.
Following these instructions (starting from Listing 5) I came to this:
namespace Nerd.Controllers
{
// View Model Classes
...
I'm trying to use the Html.DropDownListFor<> HtmlHelper and am having a little trouble binding on post. The HTML renders properly but I never get a "selected" value when submitting.
<%= Html.DropDownListFor( m => m.TimeZones, Model.TimeZones, new { @class = "SecureDropDown", name = "SelectedTimeZone" } ) %>
[Bind(Exclude = "TimeZone...
I was watching the HaHaa presentation on ASP.NET MVC from MIX and they mentioned using a Post Model where I guess they were saying you could use a model that was ONLY for posting. I have tried looking for examples for this. Am I not understanding what they are saying? Does anyone have an example of how this might work in a strongly typed...
Hi
I can't figure out how to pass parameters to my viewmodels from other views or viewmodels.
For instance, I have a View called Customers. There is a grid inside, and if you double-click the grid, a new view is supposed to come up and allow you to edit that customer's data. But how will the View(Model) responsible for editing data kno...
I have a database table that records what publications a user is allowed to access. The table is very simple - it simply stores user ID/publication ID pairs:
CREATE TABLE UserPublication (UserId INTEGER, PublicationID INTEGER)
The presence of a record for a given user & publication means that the user has access; absence of a record i...
My generic question is as the title states, is it best to load data during ViewModel construction or afterward through some Loaded event handling?
I'm guessing the answer is after construction via some Loaded event handling, but I'm wondering how that is most cleanly coordinated between ViewModel and View?
Here's more details about my ...
I am using the MVVM Light framework as well as Unity for DI. I have some nested Views, each bound to a corresponding ViewModel. The ViewModels are bound to each View's root control DataContext via the ViewModelLocator idea that Laurent Bugnion has put into MVVM Light. This allows for finding ViewModels via a static resource and for contr...
I have an asp.net mvc 2 app. I need to display the same page to each user. But each user has different rights to the data. IE some can see but not edit some data, some cannot edit nor see the data. Ideally data that cannot be seen nor edited is whitespace on the view. For security reasons I want my viewmodels to be sparse as possible. ...
I have a couple of Storyboards in my view that I would like to trigger from the ViewModel if possible. Is there a simple way or elegant way of doing this. Here is what I am trying to do.
Person Clicks on a Button-->RelayCommand (In the ViewModel), the Relay Command should then play the storyboard. Also one more thing, I would like to a...
I couldn't find any documentation around using multiple forms in an ASP.NET MVC 2 ViewModel approach.
i.e. In the built in application when you select New MVC2 web app, the register page uses a ViewPage which inherits like this:
Inherits="System.Web.Mvc.ViewPage<rs30UserWeb.Models.RegisterModel>"
I wanted to use that approach on a pag...
Hi all
I've see a lot of MVC examples where domain-objects are passed directly to views, this will work fine if your view is simple.
The common alternative is to have a view-model which has all the same properties as your domain-model + any extra properties your view may need (such as 'confirmPassword').
Before doing too much reading a...
As I understand it, Domain Models are classes that only describe the data (aggregate roots). They are POCOs and do not reference outside libraries (nothing special).
View models on the other hand are classes that contain domain model objects as well as all the interface specific objects like SelectList. A ViewModel includes using Sy...
Hello,
In the project I'm working on I have got a list List<Item> with objects that Is saved in a session. Session.Add("SessionName", List);
In the Controller I build a viewModel with the data from this session
var arrayList = (List<Item>)Session["SessionName"];
var arrayListItems= new List<CartItem>();
foreach (var item in arrayList...
Ok, i got a viewmodel as follows:
public class PageViewModel
{
public Item Item { get; set; }
...
public PageViewModel
{ }
public PageViewModel(Item itemWebPage)
{
...
}
}
I use a form to edit this Item using a route like:
/Controller/Edit/43
The controller uses this code:
[AcceptVerbs("GET")]
p...
I have the following attribute
public class ImportStatusAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
var model = (IHasStatus)filterContext.Controller.ViewData.Model;
model.Status = (StatusMessageViewModel)filterContext.Controller.TempData["status...
I have just started learning MVVM and having a dilemna.
If I have a a main ViewModel and inside this model I have a number of datasets. Now should I be creating a new ViewModel for each row inside the dataset? Or expose the DataSet itself as a DependencyProperty?
For now the dataset has about 20 rows inside it, and the thought of itera...
Hi there, I have a load of ADO.NET Entities in my MVC project. I was going to use these entities directly from my views/controllers... however, I think it's probably best to use ViewModels which more accurately reflect what the View requires.
I'm looking for a way that I can auto-generate a ViewModel from an existing Entity, i.e., auto...
Hello guys my first post on SO because EE sucks in the meantime ;P
I am using wpf and mvvm in my desktop application.
Scenario:
I have a calendar with week A and week B which are rotating by every X week depending on the user settings. But the UserControl "week B" is only visible when the user sets the option "rotating weeks"...
The ...
I am using the Model-View pattern on a small application I'm writing. Here's the scenario: The model maintains a list of directories from where it can extract the data that it needs. The View has a Configuration or a Setting dialog where the user can modify this list of directories (the dialog has a JList displaying the list in addition ...
Hello,
this I got: A first chance exception of type 'System.NullReferenceException' occurred in PresentationFramework.dll
When I use a parameter for the constructor of my LessonPlannerViewModel class.
I use a datatemplateselector class to switch between weekly/daily view.
public class ApplicationNavigationTemplateSelector : DataTempl...