Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lennart Stoop 304 posts 842 karma points
    Jun 17, 2014 @ 14:15
    Lennart Stoop
    0

    Cannot use property Model in view models

    Hi guys,

    I'm finally working on an Umbraco 7 project (hooray!) but just spend some time investigating a surface controller for which the model went missing after HTTP POST. In the controller action the view model returned would always be NULL:

        [HttpPost]
        public ActionResult HandleFormSubmit(PublicationFormViewModel model)
        {
    
        }
    

    After tripple-checking my setup everything seemed to be in place so I started removing some fields from the form in the view, and it turns out a property named "Model" of type int is the culprit:

    public class PublicationFormViewModel
    {
        public int Model { get; set; }
    }
    

    Once I renamed this property, the view model is passed to the controller correctly after post.

    So I was wondering, is this some kind of built-in property used by ASP.NET MVC or Umbraco?

    Thanks Lennart

Please Sign in or register to post replies

Write your reply to:

Draft