Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Nov 14, 2012 @ 06:06
    Tom
    0

    Umbraco 4.10.0 Razor Views and Partials

     

    I just had a couple of questions about structuring a solution.

     

    1. Would you generally use custom controllers with custom view models for the overall layout of the page etc and then when dealing with gets and posts have to use surface controllers?

     

    2. Can a conventional controller that has hijacked a route handle the gets and posts or does it have to be done with partial views and surface controllers?

     

    3. If you wanted to make use of the new 4.5 API controllers etc would the best way be to custom route and then add to umbracos reserved urls?

     

     

    Playing around with 4.10 and been reading up on the md docs on github re strongly typed partial views.

     

    Just wondering if you had a scenario where you wanted to pass a custom ViewModel down into a partial for use would you need to assign that partial view to the ViewBag as described here: our.umbraco.org/.../30706-Passing-Models-to-Partial-Views

     

    or alternatively is there a cleaner solution.

    What I'm having difficulty understanding is how you could work with custom views within the new Mvc functionality.

     

    I tried running up a PartialView like this example: 

     

    @foreach(var page in Model.Content.Children.Where(x => x.IsVisible())){
            <div>
                @Html.Partial("ChildItem", page)
            </div>
        }
    

    and in the partial when trying to access properties of the Model using  @Model.Content.GetProperty("blah").Value is returning  Umbraco.Web.Models.XmlPublishedContentProperty

     

    Cheers,

    Tom

     

Please Sign in or register to post replies

Write your reply to:

Draft