-
marcind
asp.net-mvc viewmodel viewdata asp.net-mvc-3
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 we don’t get any of the 2)’s goodies?
-
Boas Enkler
viewmodel mvvm-light
In our application customers can design their ui on their on. For this we load the generated XAML at runtime.We use MvvmLight as Mvvm Framework.But I’m not sure what the best way is to get some kind of a dynamic view model.So if the customer wants a new Datafield it should be aviable in the model.My idea is to dynamically generated and compile a model assembly or to have converters which get their data from a Dictionary which is placed on the viewmodel.Are there any better ideas, or some experie
-
gabe
asp.net-mvc asp.net-mvc-3 viewmodel access-modifiers strongly-typed-view
I have some internal automatic properties in my view model but my strongly-typed view doesn’t see them. Everything is in the same assembly, so why is this happening?public class MyViewModel {public int PublicProperty { get; set; }internal int InternalProperty { get; set; } }.@*My view*@ @model [email protected]@Model.InternalProperty @*Causes compilation error*@
-
Mike Kantor
asp.net-mvc razor viewmodel
depending on configuration at each site, some fields on a form may or may not be required. Can I apply the [Required] attribute to fields of my ViewModel in code? I’d like to take advantage of all the conveniences of form validation, but I can’t hard-code the [Required] attribute.
-
Matt Mangold
asp.net-mvc asp.net-mvc-3 dynamic views viewmodel
Traditionally, I have built MVC applications using view models with Data Annotations attributes, and I dynamically render the views using editor templates. Everything works great, and it really cuts down on the time it takes me to build new views. My requirements have recently changed. Now, I can’t define the view model at design time. The properties that will be rendered on the view are decided at run time based on business rules. Also, the validation rules for those properties may be deci
-
Jackson Dean Goodwin
wpf binding user-controls window viewmodel
I have a portion of a Window that should display one of several UserControls. Each UserControl presents the same data, only in a different format, arrangement, and style. The particular UserControl that will be presented in this section of the Window should be determined by a single setting that is stored in the ViewModel of the Window.How can I make it so that the program end user can change the UserControl that is displayed in the Window at run-time?
-
Brendan Hill
c# mvc viewmodel strong-typing
I see a lot of posts about strongly typing the View’s model data.I am interested in somehow strongly typing the View itself.It concerns me that a controller action returning View(xyz) could crash at run-time, if the view’s model type changes, or the name / location of the view itself changes. In my opinion, the loose coupling of the MVC framework goes too far in this specific area, becoming counterproductive in a RAD environment. (not getting immediately notification of breaking changes)Is there
-
FrankCap
c# windows-phone-7 viewmodel webclient
I have a refresh button to update news in my WP7 application. When I double or triple click on the refresh button I am getting an error”WebClient does not support concurrent I/O operations” .I think thats because It is sending the request triple times and making it crash. Here is my Click code.private void NewsRefresh_Click(object sender, RoutedEventArgs e){var vm = this.DataContext as MainPageViewModel;if (vm != null){vm.UpdateNews();}}How can I turn it as “if It is busy cancel the process”.
-
Naser Asadi
wpf constructor viewmodel
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 pass the person object to the constructor of the ViewModel…How do you cope with that situation?
-
teresko
asp.net-mvc razor dictionary checkbox viewmodel
I’m using MVC 4, .Net 4, and Visual Studio 2012.I’m trying to use a fairly complex model with one of my views, and I’m having serious trouble getting it to bind properly.The model wraps a Dictionary with integer Keys, and Values that are Lists of Lists of bools.Basically, a search was done on items indicated by the integer, each item had several search terms, and for each of those terms we have a list of results. I display the results on a page, and have a checkbox next to each result. For each
-
garfbradaz
asp.net-mvc-3 controller viewmodel
EDIT FOR SOLUTION:The answer can be found here:http://forums.asp.net/p/1794394/4941748.aspx/1?p=True&t=634704481730535356 BUT please see the below from Ricardo as well.I’ve got a Controller/View called LedgerUser. I have a ViewModel called LedgerViewModel which contains an instance of LedgerUser and SelectList for instances of UserType and a property called UniqueId which i use for Images. Now when i POST the form back from my Create View I get the following error:The model item passed into
-
von v.
asp.net-mvc asp.net-mvc-3 viewmodel asp.net-mvc-viewmodel
When I click submit in order to create an account the following error is displayed. I can’t find why it is giving the following error. Also I tried to use breakpoints and debugging but it was uselessNo parameterless constructor defined for this object.Description: An unhandled exception occurred during the execution ofthe current web request. Please review the stack trace for moreinformation about the error and where it originated in the code. Exception Details: System.MissingMethodException: No
-
Xaxum
c# asp.net-mvc-4 viewmodel
I have a viewmodel which needs data from two models person and address:Models:public class Person {public int Id { get; set; }public string Name { get; set; }public int Age { get; set; }public int Gender { get; set; } }public class Address {public int Id { get; set; }public string Street { get; set; }public int Zip { get; set; }public int PersonId {get; set; } }The Viewmodel is as suchpublic class PersonAddViewModel {public int Id { get; set; }public string Name { get; set; }public string Street
-
scapegoat17
asp.net-mvc-3 viewmodel
I am working on creating a datagrid in ASP MVC 3 where I have two tables in one view. Each table is being used from its own Model. Therefore, I would have to call two Models into one View which does not seem as simple as I wish it was. I am pretty new to MVC and I was looking through Stack and found this link: Two models in one view in ASP MVC 3Which seems to be the direction that i would want to go… I think.Here is the code for my first model:[Table] public class Model1 {[Column(IsPrimaryKey
-
BillPull
javascript knockout.js viewmodel knockout-mvc
I am trying to create and initialize some sort of master view model that contains common view models that might be run on every page and page specific models that are appended on page load.var MasterViewModel = {commonViewModel1 : CommonViewModel1(),commonViewModel2 : CommonViewModel1() };var commonInit = function() {// Populate View Model DataMasterViewModel.commonViewModel1 = initCommonViewModel1();MasterViewModel.commonViewModel2 = initCommonViewModel2();// Apply common view model bindingsko.
-
Pedro del Sol
javascript ajax asp.net-mvc-3 viewmodel knockout.js
I’m looking for advice on how to populate the viewmodel passed to the view after a list is retrieved and an item selected in a dropdown list. Note that I also have a client side viewmodel that is used for the Ajax/Knockout client code but this is not the view model that I am trying to populate. I may have to map from one view model to the other but I’m not sure if that is the correct solution.View – Form In my form I am using Knockout and JavaScript for my dropdowns. How can I populate the v
-
AlfeG
javascript data-binding mvvm viewmodel knockout.js
Looking for a good example of how to set up child models in knockoutjs. This includes binding to child events such as property updates which I haven’t been able to get working yet. Also, it would be better to bind to a single child in this case instead of an array but I don’t know how to set it up in the html without the foreach template.http://jsfiddle.net/mathewvance/mfYNq/Thanks.<div class=”editor-row”><label>Price</label><input name=”Price” data-bind=”value: price”/>
-
Gilles
c++ opengl viewmodel transformation
I am trying to understand the glLookAt function. It takes 3 triplets. The first is the eye position, the second is the point at which the eye stares. That point will appear in the center of my viewport, right? The third is the ‘up’ vector. I understand the meaning of the ‘up’ vector if it is perpendicular to the vector from eye to starepoint. The question is, is it allowed to specify other vectors for up, and, if yes, what’s the meaning then?A link to a graphical detailed explanation of gluPerst
-
CHAT_2013
knockout.js viewmodel
I have the following viewmodel defined:function BookCartViewModel() { this.Books = ko.observableArray([]); this.Categories = ko.observableArray([]); }var Book = function (data) {this.ISBN = ko.observable(data.ISBN);this.BookID = ko.observable(data.BookID);this.BookName = ko.observable(data.Name);this.Price = ko.observable(data.Price);this.Publisher = ko.observable(data.Publisher);this.PublishedDate = ko.observable(data.PublishedDate);this.Authors = ko.observableArray(data.Authors);this.Category
-
Nanda
asp.net-mvc-3 enums viewmodel
I have a database first model, where is a Person entity, like this:public partial class Person {public System.Guid personID { get; set; } public string firstName { get; set; } public string lastName { get; set; }public string sex { get; set; } // since in the DB it is char(1), default = ‘F’ }I defined a public enum for sex selection:public enum Sex {M, F}which I want to use it to select the sex of the person and to render it as a radio button group.I followed this solution: pass enum to html.rad