Copied to clipboard

Flag this post as spam?

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


  • mico 10 posts 30 karma points
    Feb 04, 2014 @ 20:03
    mico
    0

    A model under partial view doesn't work

    Im using Umbraco7 with MVC engine.

    I have some partial view control and im unable to set a simple post method (for ajax) which returns my custom web model. I also checked the link (which didn't quite help me): http://our.umbraco.org/documentation/Reference/Mvc/partial-views

    my main problem is that the partial view doesn't load correctly, also, if there are any examples out there i'll thank you if u can add a link/provide some code example.


    anyway, my code includes:

    cshtml

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @model Umb7MVC.Models.MyCustomModel

    <section class="wrapper" id="home">..some html</section>
    <strong>@Model.MyProperty</strong>

    HomeController

    [HttpPost]
            public JsonResult Index(MyCustomModelmodel)
            {
                model.MyProperty = "some value";
                return Json(new { result = "ok" });
            }

    custom model

        public class MyCustomModel
       {
            public string MyProperty { get; set; }
        }

Please Sign in or register to post replies

Write your reply to:

Draft