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:02
    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

    ..some html
    @Model.MyProperty

    HomeController

     

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

    custom model

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

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies