Hot answers tagged

2

I think this is the main difference between MVC and MVVM approaches. In MVC you have the controller populates the ViewModel which is essentially just the a struct of the various data the view needs In MVVM you don't have a controller, so all the logic goes in the ViewModel, which is now a 'proper' class with methods and everything. If you are in the ASP ...


1

Because the view model is recreated with each request, it can be a good idea to separate the "thing" that creates the options for your drop downs from your view models. It has the added benefit of making it even easier to added auto fill drop downs later, where you have a controller action that simply returns new options for the drop down in JSON format. I ...


1

If the page is posted, and there's an error like they forgot to put a User Name in, we redirect them to the page again to try again, at which point we also have to remember to repopulate the model's List before redirecting them back to the page. As you mention, main problem is recalculating or refilling something in post method. Also, you already fill data ...


Only top voted, non community-wiki answers of a minimum length are eligible