Search Results

Search found 32302 results on 1293 pages for 'model view viewmodel'.

Page 11/1293 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Should I map a domain object to a view model using an optional constructor?

    - by Byron Sommardahl
    I'd like to be able to map a domain model to a view model by newing up a view model and passing in the contributing domain model as a parameter (like the code below). My motivation is to keep from re-using mapping code AND to provide a simple way to map (not using automapper yet). A friend says the view model should not know anything about the "payment" domain model that's being passed into the optional constructor. What do you think? public class LineItemsViewModel { public LineItemsViewModel() { } public LineItemsViewModel(IPayment payment) { LineItemColumnHeaders = payment.MerchantContext.Profile.UiPreferences.LineItemColumnHeaders; LineItems = LineItemDomainToViewModelMapper.MapToViewModel(payment.LineItems); ConvenienceFeeAmount = payment.ConvenienceFee.Fee; SubTotal = payment.PaymentAmount; Total = payment.PaymentAmount + payment.ConvenienceFee.Fee; } public IEnumerable<Dictionary<int, string>> LineItems { get; set; } public Dictionary<int, string> LineItemColumnHeaders { get; set; } public decimal SubTotal { get; set; } public decimal ConvenienceFeeAmount { get; set; } public decimal Total { get; set; } }

    Read the article

  • Loading and binding a serialized view model to a WPF window?

    - by generalt
    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 are specific to the user. I figured I could serialize the view model, which contains all the data from the textboxes, and this works fine, but I'm having trouble loading the information in the serialized XML file back into the text boxes. Constructor of window: public ETLWindow() { InitializeComponent(); _viewModel = new ViewModel(); this.DataContext = _viewModel; _viewModel.State = Constants.STATE_IDLE; Loaded += new RoutedEventHandler(MainWindow_Loaded); } XAML: <TextBox x:Name="targetDirectory" IsReadOnly="true" Text="{Binding TargetDatabaseDirectory, UpdateSourceTrigger=PropertyChanged}"/> ViewModel corresponding property: private string _targetDatabaseDirectory; [XmlElement()] public string TargetDatabaseDirectory { get { return _targetDatabaseDirectory; } set { _targetDatabaseDirectory = value; OnPropertyChanged(DataUtilities.General.Utilities.GetPropertyName(() => new ViewModel().TargetDatabaseDirectory)); } Load event in code behind: private void loadState_Click(object sender, RoutedEventArgs e) { string statePath = this.getFilePath(); _viewModel = ViewModel.LoadModel(statePath); } As you can guess, the LoadModel method deserializes the serialized file on the user's drive. I couldn't find much on the web regarding this issue. I know this probably has something to do with my bindings. Is there some way to refresh on the bindings on the XAML after I deserialize the view model? Or perhaps refresh all properties on the view model? Or am I completely insane thinking any of this could be done? Thanks.

    Read the article

  • Core Data migration problem: "Persistent store migration failed, missing source managed object model

    - by John Gallagher
    The Background A Cocoa Non Document Core Data project with two Managed Object Models. Model 1 stays the same. Model 2 has changed, so I want to migrate the store. I've created a new version by Design Data Model Add Model Version in Xcode. The difference between versions is a single relationship that's been changed from to a one to many. I've made my changes to the model, then saved. I've made a new Mapping Model that has the old model as a source and new model as a destination. I've ensured all Mapping Models and Data Models and are being compiled and all are copied to the Resource folder of my app bundle. I've switched on migrations by passing in a dictionary with the NSMigratePersistentStoresAutomaticallyOption key as [NSNumber numberWithBool:YES] when adding the Persistent Store. Rather than merging all models in the bundle, I've specified the two models I want to use (model 1 and the new version of model 2) and merged them using modelByMergingModels: The Problem No matter what I do to migrate, I get the error message: "Persistent store migration failed, missing source managed object model." What I've Tried I clean after every single build. I've tried various combinations of having only the model I'm migrating to in Resources, being compiled, or both. Since the error message implies it can't find the source model for my migration, I've tried having every version of the model in both the Resources folder and being compiled. I've made sure I'm not making a really basic error by switching back to the original version of my data model. The app runs fine. I've deleted the Mapping Model and the new version of the model, cleaned, then recreated both. I've tried making a different change in the new model - deleting an entity instead. I'm at my wits end. I can't help but think I've made a huge mistake somewhere that I'm not seeing. Any ideas?

    Read the article

  • Passing ViewModel for backbone.js from MVC3 Server-Side

    - by Roman
    In ASP.NET MVC there is Model, View and Controller. MODEL represents entities which are stored in database and essentially is all the data used in a application (for example, generated by EntityFramework, "DB First" approach). Not all data from model you want to show in the view (for example, hashs of passwords). So you create VIEW MODEL, each for every strongly-typed-razor-view you have in application. Like this: using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MyProject.ViewModels.SomeController.SomeAction { public class ViewModel { public ViewModel() { Entities1 = new List<ViewEntity1>(); Entities2 = new List<ViewEntity2>(); } public List<ViewEntity1> Entities1 { get; set; } public List<ViewEntity2> Entities2 { get; set; } } public class ViewEntity1 { //some properties from original DB-entity you want to show } public class ViewEntity2 { } } When you create complex client-side interfaces (I do), you use some pattern for javascript on client, MVC or MVVM (I know only these). So, with MVC on client you have another model (Backbone.Model for example), which is third model in application. It is a bit much. Why don`t we use the same ViewModel model on a client (in backbone.js or another framework)? Is there a way to transfer CS-coded model to JS-coded? Like in MVVM pattern, with knockout.js, when you can do like this: in SomeAction.cshtml: <div style="display: none;" id="view_model">@Json.Encode(Model)</div> after that in Javascript-code var ViewModel = ko.mapping.fromJSON($("#view_model").get(0).innerHTML); now you can extend your ViewModel with some actions, event handlers, etc: ko.utils.extend(ViewModel, { some_function: function () { //some code } }); So, we are not building the same view model on the client again, we are transferring existing view model from server. At least, data. But knockout.js is not suitable for me, you can`t build complex UI with it, it is just data-binding. I need something more structural, like backbone.js. The only way to build ViewModel for backbone.js I can see now is re-writing same ViewModel in JS from server with hands. Is there any ways to transfer it from server? To reuse the same viewmodel on server view and client view?

    Read the article

  • WPF List of ViewModels bound to list of Model objects.

    - by Eric
    In the model, I have: public ObservableCollection<Item> Items { get; private set; } In the ViewModel, I have a corresponding list of ItemViewModels: public ObservableCollection<ItemViewModel> ItemViewModels ... In the XAML, I will bind (in this case a TreeView) to the ItemViewModels property. My question is, what goes in the "..." in the ViewModel shown above? I am hoping for a line or two of code to binds these two ObservableCollections (providing the type of the ViewModel to construct for each model object). However, what I'm fearing is necessary is a bunch of code to handle the Items.CollectionChanged event and manually updates the ItemViewModels list by constructing ViewModels as necessary. Thanks! Eric

    Read the article

  • 3D Model not translating correctly (visually)

    - by ChocoMan
    In my first image, my model displays correctly: But when I move the model's position along the Z-axis (forward) I get this, yet the Y-axis doesnt change. An if I keep going, the model disappears into the ground: Any suggestions as to how I can get the model to translate properly visually? Here is how Im calling the model and the terrain in draw(): cameraPosition = new Vector3(camX, camY, camZ); // Copy any parent transforms. Matrix[] transforms = new Matrix[mShockwave.Bones.Count]; mShockwave.CopyAbsoluteBoneTransformsTo(transforms); Matrix[] ttransforms = new Matrix[terrain.Bones.Count]; terrain.CopyAbsoluteBoneTransformsTo(ttransforms); // Draw the model. A model can have multiple meshes, so loop. foreach (ModelMesh mesh in mShockwave.Meshes) { // This is where the mesh orientation is set, as well // as our camera and projection. foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.PreferPerPixelLighting = true; effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(modelRotation) * Matrix.CreateTranslation(modelPosition); // Looking at the model (picture shouldnt change other than rotation) effect.View = Matrix.CreateLookAt(cameraPosition, modelPosition, Vector3.Up); effect.Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f); effect.TextureEnabled = true; } // Draw the mesh, using the effects set above. prepare3d(); mesh.Draw(); } //Terrain test foreach (ModelMesh meshT in terrain.Meshes) { foreach (BasicEffect effect in meshT.Effects) { effect.EnableDefaultLighting(); effect.PreferPerPixelLighting = true; effect.World = ttransforms[meshT.ParentBone.Index] * Matrix.CreateRotationY(0) * Matrix.CreateTranslation(terrainPosition); // Looking at the model (picture shouldnt change other than rotation) effect.View = Matrix.CreateLookAt(cameraPosition, terrainPosition, Vector3.Up); effect.Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f); effect.TextureEnabled = true; } // Draw the mesh, using the effects set above. prepare3d(); meshT.Draw(); DrawText(); } base.Draw(gameTime); } Im suspecting that there may be something wrong with how I'm handling my camera. The model rotates fine on its Y-axis.

    Read the article

  • Recommended book on Actors concurrency model (patterns, pitfalls, etc.)?

    - by Larry OBrien
    The Actors concurrency model is clearly gaining favor. Is there a good book that presents the patterns and pitfalls of the model? I am thinking about something that would discuss, for instance, the problems of consistency and correctness in the context of hundreds or thousands of independent Actors. It would be okay if it were associated with a specific language (erlang, I would imagine, since that seems universally regarded as the proven implementation of Actors), but I am hoping for something more than an introductory chapter or two. (FWIW, I'm actually most interested in Actors as they are implemented in Scala.)

    Read the article

  • What are the recommended resources for learning about the Actor model of concurrent systems?

    - by Larry OBrien
    The Actor concurrency model is clearly gaining favor. Is there a good book that presents the patterns and pitfalls of the model? I am thinking about something that would discuss, for instance, the problems of consistency and correctness in the context of hundreds or thousands of independent Actors. It would be okay if it were associated with a specific language (Erlang, I would imagine, since that seems universally regarded as the proven implementation of Actors), but I am hoping for something more than an introductory chapter or two. I'm actually most interested in Actors as they are implemented in Scala, if there are any such resources available.

    Read the article

  • ASP.NET MVC 1: Model Binding With Disabled Textbox

    - by modernzombie
    I have a textbox that I am defining as <%= Html.TextBox("Username", Model.Form.Username, new { @class = "textbox", @disabled = "disabled" })%> In my action [AcceptVerbs(HttpVerbs.Post)] [ValidateAntiForgeryToken] public ActionResult EditLogin(LoginForm post) { ... return View(model); } post.Username will be blank, all other properties bind correctly, but if I change @disabled="disabled to @readonly="readonly" the username binds properly and everything works. It looks like model binding ignores values in disabled fields. Is their a way around this? I still need the field's value to bind to the model. I can use readonly but would prefer to use disabled so it is visually apparent to the user that they cannot edit the value of the field.

    Read the article

  • Is Inheritance in Struts2 Model-Driven Action possible?

    - by mryan
    Hello, I have a Model-Driven Struts2 action that provides correct JSON response. When I re-structure the action I get an empty JSON response back. Has anyone got inheritance working with Struts2 Model-Driven actions? Ive tried explicitly setting include properties in struts config: <result name="json" type="json"> <param name="includeProperties"> jsonResponse </param> </result> Code for all actions below - not actual code in use - I have edited and stripped down for clarity. Thanks in advance. Action providing correct response: public class Bike extends ActionSupport implements ModelDriven, Preparable { @Autowired private Service bikeService; private JsonResponse jsonResponse; private com.ets.model.Vehicle bike; private int id; public Bike() { jsonResponse = new JsonResponse("Bike"); } @Override public void prepare() throws Exception { if (id == 0) { bike = new com.ets.model.Bike(); } else { bike = bikeService.find(id); } } @Override public Object getModel() { return bike; } public void setId(int id) { this.id = id; } public void setBikeService(@Qualifier("bikeService") Service bikeService) { this.bikeService = bikeService; } public JsonResponse getJsonResponse() { return jsonResponse; } public String delete() { try { bike.setDeleted(new Date(System.currentTimeMillis())); bikeService.updateOrSave(bike); jsonResponse.addActionedId(id); jsonResponse.setAction("delete"); jsonResponse.setValid(true); } catch (Exception exception) { jsonResponse.setMessage(exception.toString()); } return "json"; } } Re-structured Actions providing incorrect response: public abstract class Vehicle extends ActionSupport implements ModelDriven { @Autowired protected Service bikeService; @Autowired protected Service carService; protected JsonResponse jsonResponse; protected com.ets.model.Vehicle vehicle; protected int id; protected abstract Service service(); @Override public Object getModel() { return bike; } public void setId(int id) { this.id = id; } public void setBikeService(@Qualifier("bikeService") Service bikeService) { this.bikeService = bikeService; } public void setCarService(@Qualifier("carService") Service carService) { this.carService = carService; } public JsonResponse getJsonResponse() { return jsonResponse; } public String delete() { try { vehicle.setDeleted(new Date(System.currentTimeMillis())); service().updateOrSave(vehicle); jsonResponse.addActionedId(id); jsonResponse.setAction("delete"); jsonResponse.setValid(true); } catch (Exception exception) { jsonResponse.setMessage(exception.toString()); } return "json"; } } public class Bike extends Vehicle implements Preparable { public Bike() { jsonResponse = new JsonResponse("Bike"); } @Override public void prepare() throws Exception { if (id == 0) { vehicle = new com.ets.model.Bike(); } else { vehicle = bikeService.find(id); } } @Override protected Service service() { return bikeService; } } public class Car extends Vehicle implements Preparable { public Car() { jsonResponse = new JsonResponse("Car"); } @Override public void prepare() throws Exception { if (id == 0) { vehicle = new com.ets.model.Car(); } else { vehicle = carService.find(id); } } @Override protected Service service() { return carService; } }

    Read the article

  • Adding a modal view controller when I press a info button inside a tableviewCell

    - by gvalero87
    Hi, Here is a complex question, maybe it's not hard but there are many doubts i have. First let me give you what i have. This is the only place where i've gotten good answers. I have a table view controller with custom cells. In those cells i added a button (info dark one from IB) for each one of the cells. What i would like it's that when I press that button it displays a new view with more information about that cell, different of the view that i get from didSelectRowAtIndexPath. I've read a little bit about Modal View Controller and I think this is a case where I should use it. So here are my questions: How do i make a view controller a modal view controller?. I read that i have to have a delegate. Is there an example of how to create a normal modal view controller. I haven't been able to do so. How can this button know which cell is it from?. What i have right is a subclass tableviewcell with an IBOUTLET to this info button. This is not an important question because i guess i just could add a NSIndexPath attribute. I added an action in my tableviewsubclass that is triggered when the touchDown Event is called. I did this connection through IB. How can I call the modal view controller through here?, and is it even the right place to do this? Thanks

    Read the article

  • Model validation with enumerable properties in Asp.net MVC2 RTM

    - by Robert Koritnik
    I'm using DataAnnotations attributes to validate my model objects. My model class looks similar to this: public class MyModel { [Required] public string Title { get; set; } [Required] public List<User> Editors { get; set; } } public class User { public int Id { get; set; } [Required] public string FullName { get; set; } [Required] [DataType(DataType.Email)] public string Email { get; set; } } My controller action looks like: public ActionResult NewItem(MyModel data) { //... } User is presented with a view that has a form with: a text box with dummy name where users enter user's names. For each user they enter, there's a client script coupled with ajax that creates an <input type="hidden" name="data.Editors[0].Id" value="userId" /> for each user entered (enumeration index is therefore not always 0 as written here), so default model binder is able to consume and bind the form without any problems. a text box where users enter the title Since I'm using Asp.net MVC 2 RTM which does model validation instead of input validation I don't know how to avoid validation errors. The thing is I have to use BindAttribute on my controller action. I would have to either provide a white or a black list of properties. It's always a better practice to provide a white list. It's also more future proof. The problem My form works fine, but I get validation errors about user's FullName and Email properties since they are not provided. I also shouldn't feed them to the client (via ajax when user enters user data), because email is personal contact data and is not shared between users. If there was just a single user reference on MyModel I would write [Bind(Include = "Title, Editor.Id")] But I have an enumeration of them. How do I provide Bind white list to work with my model?

    Read the article

  • Model availability inside ActionFilter

    - by Sayed Ibrahim Hashimi
    I have created a new ActionFilter for an ASP.NET MVC application that I'm creating. I have an action which accepts an Http Post and the argument of the action method accepts an object, for which I have created and registered a custom model binder. I noticed that inside the IActionFilter.OnActionExecuting the value for filterContext.Controller.ViewData.Model is always null despite the fact that it looks like the model binder is always invoked before the action filter OnActionExecuting method. In contrast to this inside the IActionFilter.OnActionExecuted method of the same action filter the value for filterContext.Controller.ViewData.Model is not null. Do you guys know if this is by design or a bug? If by design are their any links which describe why this is? Thanks.

    Read the article

  • Model validation with enumerations

    - by Robert Koritnik
    I'm using DataAnnotations attributes to validate my model objects. My model class looks similar to this: public class MyModel { [Required] public string Title { get; set; } [Required] public List<User> Editors { get; set; } } public class User { public int Id { get; set; } [Required] public string FullName { get; set; } [Required] [DataType(DataType.Email)] public string Email { get; set; } } My controller action looks like: public ActionResult NewItem(MyModel data) { //... } User is presented with a view that has a form with: a text box with dummy name where users enter user's names. For each user they enter, there's a client script coupled with ajax that creates an <input type="hidden" name="data.Editors[0].Id" value="userId" /> for each user entered (enumeration index is therefore not always 0 as written here), so default model binder is able to consume and bind the form without any problems. a text box where users enter the title Since I'm using Asp.net MVC 2 RTM which does model validation instead of input validation I don't know how to avoid validation errors. The thing is I have to use BindAttribute on my controller action. I would have to either provide a white or a black list of properties. It's always a better practice to provide a white list. It's also more future proof. The problem My form works fine, but I get validation errors about user's FullName and Email properties since they are not provided. I also shouldn't feed them to the client (via ajax when user enters user data), because email is personal contact data and is not shared between users. If there was just a single user reference on MyModel I would write [Bind(Include = "Title, Editor.Id")] But I have an enumeration of them. How do I provide Bind white list to work with my model?

    Read the article

  • mvc presentation model best-practices

    - by Andrew Florko
    Hello, everybody How do you usually convert business objects to presentation? For example: Business object Person { Id, FirstName, LastName, Patronymic ... } should be presented as "LastName F. P. " in html layout. We use Presentation classes hierarchy to represent data ready for output from Business model. Questions: Will you keep presentation model completely separated from Business Model. For example, can strong-typed views (MVC ASP.NET) aggregate formatted business data as well as raw business objects (that leads toward <%=Html.Encode(PersonHelper.ToShort(Model.Person))% html layout injections) What architecture layer do you choose for conversion (mvc controllers that formats business data from business layer, for instance). Thank you in advance

    Read the article

  • Custom Validation Attribute with Custom Model Binder in MVC 2

    - by griegs
    I apologise for the amount of code I have included. I've tried to keep it to a minimum. I'm trying to have a Custom Validator Attribute on my model as well as a Custom Model binder. The Attribute and the Binder work great seperately but if I have both, then the Validation Attribute no longer works. Here is my code snipped for readability. If I leave out the code in global.asax the custom validation fires but not if I have the custom binder enabled. Validation Attribute; public class IsPhoneNumberAttribute : ValidationAttribute { public override bool IsValid(object value) { //do some checking on 'value' here return true; } } Useage of the attribute in my model; [Required(ErrorMessage = "Please provide a contact number")] [IsPhoneNumberAttribute(ErrorMessage = "Not a valid phone number")] public string Phone { get; set; } Custom Model Binder; public class CustomContactUsBinder : DefaultModelBinder { protected override void OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) { ContactFormViewModel contactFormViewModel = bindingContext.Model as ContactFormViewModel; if (!String.IsNullOrEmpty(contactFormViewModel.Phone)) if (contactFormViewModel.Phone.Length > 10) bindingContext.ModelState.AddModelError("Phone", "Phone is too long."); } } Global asax; System.Web.Mvc.ModelBinders.Binders[typeof(ContactFormViewModel)] = new CustomContactUsBinder();

    Read the article

  • Django anonymous user in model

    - by jack
    I have a model defined as below: class Example(models.Model): user = models.ForeignKey(User, null=True) other = models.CharField(max_length=100) The problem is Django refuses to assign django.contrib.auth.models.AnonymousUser directly to Example.user as null field so everytime I have to check if request.user.is_authenticated() ans assign Example.user = None manually. Is there a default value for AnonymousUser to use in a model field?

    Read the article

  • zend framework can't find Model classes ?

    - by user284503
    Yall: I have a simple question, it might be a simple configuration issue, but I have a Model defined, and when I try to access it from a controller it fails. The Model is in the model directory, and when I look at the quickstart app, it seems like this should work. Here is my model: <?php class Application_Model_User { protected $_user; protected $_password; protected $_userId; // very simple right } ?> My controller just stops.. here is the controller code: <?php class UserController extends Zend_Controller_Action { public function init() { } public function indexAction() { // display login form $users = new Application_Model_User(); echo "test never echos.. stopped above ? weird huh.."; // fails before .. } ?> Thank you everyone,

    Read the article

  • Alloy MVC Framework Titanium Network (Model)

    - by flyingDuck
    I'm trying to authenticate using the Model in Alloy. I have been trying to figure this problem out since yesterday. If anybody could help me, I'd really appreciate it. So, I have a view login.xml, then a controller login.js. The login.js contains the following function: var user = Alloy.Models.user; //my user.js model function login(e) { if($.username.value !== '' && $.password.value !== ''){ if(user.login($.username.value, $.password.value)){ Alloy.createController('home').getView().open(); $.login.close(); } }else{ alert('Username and/or Password required!'); } } Then in my user.js model, it's like this: extendModel : function(Model) { _.extend(Model.prototype, { login: function(username, password) { var first_name, last_name, email; var _this = this; var url = 'http://myurl.com/test.php'; var auth = Ti.Network.createHTTPClient({ onerror: function(e){ alert(e.error); }, onload: function(){ var json = this.responseText; var response = JSON.parse(json); if(response.logged == true){ first_name = response.f_name; last_name = response.l_name; email = response.email; _this.set({ loggedIn: 1, username: email, realname: first_name + ' ' + last_name, email: email, }); _this.save(); }else{ alert(response.message); } }, }); auth.open('POST', url); var params = { usernames: username, passwords: password, }; auth.send(params); alert(_this.get('email')); //alert email }, }); When I click on login in login.xml it calls the function login in index.js. So, now my problem is that, when I click the button for the first time, I get an empty alert from alert(_this.get('email')), but then when I click the button the second time, everything works fine, it alerts the email. I have no idea what's going on. Thank you for the help.

    Read the article

  • Proper design a Model-Controller in Cocoa?

    - by legege
    Hi, I'm trying to design a simple Cocoa application and I would like to have a clear and easy to understand software architecture. Of course, I'm using a basic MVC design and my question concerns the Model layer. For my application, the Model represents data fetched on the Internet with a XML-RPC API. I'm planning to use Core Data to represent a locally fetched version. How should the data be loaded initially? I'm reading the Cocoa Design Pattern book, and they talk about a Model-Controller that is centric to the Model. How would that be done? Thanks!

    Read the article

  • symfony 1.4: doctrine build model warning

    - by tigerstyle
    Hi volks, I copied my sources from my lokal dev (everything works fine) to my repository and from there I did a checkout on my remote dev. Now when I try to build everything I get this error: devel:/var/www/myproject# ./symfony doc:build-model doctrine generating model classes file+ /tmp/doctrine_schema_48726.yml Warning: file_get_contents(/var/www/myproject/lib/model/doctrine//base/BaseAdvert.class.php): failed to open stream: No such file or directory in /var/www/myproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php on line 77 Do you know what the problem could be? Thx for your answers :)

    Read the article

  • List of models in Model in MVC

    - by arri
    I have two models: class ModelIn{ public string FirstName { get; set; } public string LastName { get; set; } public string Address { get; set; } } class ModelOut{ public ModelOut(){ People = new List<ModelIn>();} public List<ModelIn> People { get; private set;} public string Country { get; set; } } And I have Controller editing ModelOut: public ActionResult People() { ... return View(SomeModelOutInstanceWith3People); } [HttpPost] public ActionResult(ModelOut m) { ... } In view I have sth like: <% using (Html.BeginForm()) { %> <%: Html.EditorFor(m => Model.Country) %> <% for(int i = 0; i < Model.People.Count; ++i){ %> <%: Html.EditorFor(m => Model.People[i].FirstName) %> <%: Html.EditorFor(m => Model.People[i].LastName) %> <%: Html.EditorFor(m => Model.People[i].Address) %> <% } %> <input type="submit" /> <% } %> It works all OK, but in post action I have empty ModelOut m. I can see in logs that data is sent correctly. I have tried everything, nothing works.

    Read the article

  • Django model help

    - by dotty
    Does anyone have any clue why this doesn't work as expected. If i use the python shell and do team.game_set or team.games It returns an error AttributeError: 'Team' object has no attribute 'game' If i create a Game object and call game.home_team it returns the correct team object Heres my model class Team(models.Model): name = models.CharField(blank=True, max_length=100) class Game(models.Model): home_team = models.ForeignKey(Team, related_name="home_team")

    Read the article

  • Implementing a Cakephp Model using an Array

    - by Zubin
    The CakePHP Cookbook states that a Model can use a file (csv for example) instead of an actual database table but I couldn't find any implementation for it. I was wondering if it is possible to use an Array of data as a model in CakePHP since I have a fairly static set of data which is important to me in a relationship with another table but it doesn't make a whole lot of sense to create a complete table for it. Is it possible to implement a CakePHP Model using an Array?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >