In my continuing journey through ASP.NET MVC, I am now at the point where I need to render an edit/create form for an entity.
My entity consists of enums and a few other models, created in a repository via LINQtoSQL.
What I am struggling with right now is finding a decent way to render the edit/create forms which will contain a few dro...
Kind of an odd question- if I'm thinking of this the wrong way please let me know. I am using an infragistics dock manager, which manages tabs as well. So I can create a TabGroupPane, and then add multiple ContentPanes, each of which has its own tab.
In each content pane, I set my viewmodel:
<ContentPane>
<viewmodels:MyViewModelFor...
This code works:
[HttpPost]
public ActionResult Edit(int id, FormCollection fc)
{
Movie movie =
(
from m in _ctx.Movie.Include("MovieActors")
where m.MovieID == id select m
).First();
MovieActorViewModel movieActor = new MovieActorViewModel(movie);
if (TryUpdateModel(movieActor))
...
Hi,
I'm looking into using MVVM and while I understand it for the most part, there is one thing I can't get my head around.
Imagine I have a View and ViewModel combination that show a list of foobars. When the user selects a foobar in the list and clicks the edit button I want the foobar to be shown in a popup dialog window so it can ...
I have a WPF listview, and in one column the cell may contain one or more ListBoxes.
When I right-click a ListBox I'm building a context menu where each item has a DelegateCommand. Currently I'm setting the command parameter to a SelectedListBox property on the page viewmodel itself as my delegate command needs to know which ListBox has...
Hi,
I have a viewmodel that contains a product and SelectList of categories.
public class AdFormViewModel
{
public AmericanAds.Model.Ad Ad { get; set; }
public SelectList Categories { get; set; }
public AdFormViewModel(AmericanAds.Model.Ad ad, SelectList categories)
{
Ad = ad;
Categories = categories;
...
I have a strong type view of type
List<List<MyViewModelClass>>
The outer list will always have two lists of List<MyViewModelClass>. For each of the two outer lists I want to display a group of checkboxes. Each set can have an arbitrary number of choices.
My view model class looks similar to this:
public class MyViewModelClass
{
...
i created a model object in PHP
class User {
public $title;
public function changeTitle($newTitle){
$this->title = $newTitle;
}
}
How do i expose the property of a User object in smarty just by assigning the object?
I know i can do this
$smarty->assign('title', $user->title);
but my object has something like over 20 p...
I want a list of different (derived) object types working with the Default Modelbinder in Asp.net MVC 2.
I have the following ViewModel:
public class ItemFormModel
{
[Required(ErrorMessage = "Required Field")]
public string Name { get; set; }
public string Description { get; set; }
[Scaffold...
I am getting started with Entity Framework using EF4 in VS 2010 RC. So far, I have done some simple console apps where I create an EDM, query it using LINQ to Entities, and output the results to the console.
Now I am building a demo WPF app to learn how to integrate EF4 with WPF. I use MVVM in my WPF apps, where each view (more or less)...
I have an ASP.Net MVC Controller with a 'MapColumns' action along with a corresponding ViewModel and View.
I'm using the defaultModelBinder to bind a number of drop down lists to a Dictionary in the ViewModel. The view model also contains an IList field for both source and destination columns which are used to render the view.
My quest...
Data Layer
I have an Order class as an entity. This Order entity is my model object.
Order can be different types, let it be
A
B
C
D
Also Order class may have common properties like Name, Time of creation, etc.
Also based on the order type there are different fields that are not common.
View Layer
The view contains the followi...
I'm working on a WPF application, and I'm structuring it using the MVVM pattern. Initially I had an idea that the ViewModels should be reusable, but now I'm not too sure anymore.
Should I be able to reuse my ViewModels if I need similar functionality for a WinForms application?
Silverlight doesn't support all things WPF does - should...
When I want to implement ViewModel I should cut everything c# code from my Silverlight code behind(next delete .cs file and leave only .xaml file) and paste it in new class in new folder ViewModel ? It is good way of separate View from logic ?
...
In my ASP.NET MVC app, I have a fairly complex edit page which combines a number of models into one view.
I'm using the ViewModel pattern to combine all of this information and present one cohesive object to the View.
As an example, my ViewModel structure is something like this:
CompanyId
CompanyName
List<Employee> Employees
List<Cont...
Hello all.
I'm writing a one-window UI for a simple ETL tool. The UI consists of the window, the code behind for the window, a view model for the window, and the business logic. I wanted to provide functionality to the users to save the state of the UI because the content of about 10-12 text boxes will be reused between sessions, but ...
I am trying to figure out the best way to select all the text in a TextBox the first time the control is loaded. I am using the MVVM pattern, so I am using two-way binding for the Text property of the TextBox to a string on my ViewModel. I am using this TextBox to "rename" something that already has a name, so I would like to select the ...
I have a datagrid on a view that is bound to a viewmodel. When I initialze the view, the datagrid is populated with data from the viewmodel (ObservableCollection) as it should. However, with I try to do a search against the data, the datagrid does not get refreshed from the viewmodel. When I breakpoint the code in my viewmodel, I can see...
I want to use RenderPartial twice in my view with different models associated. The problem is that some properties are present in both models (nickname, password). They have no prefix, so even the id's or names are equal in the output. Now, if I have model errors for nickname or password, both fields get highlighted.
Main View:
<div>
...
I am trying to create a site using the ASP MVC Framework. Some of the documentation use the IRepository pattern to abstract the information being sent to the view for rendering, while others recommend using a ViewModel (as in MVVC).
What is the difference?
Aren't these the same concept?
Thanks in advance
...