Copied to clipboard

Flag this post as spam?

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


  • ali 39 posts 121 karma points
    Mar 14, 2020 @ 13:13
    ali
    0

    Umbraco Doc type grid layout error

    Hello i fallow this tutorial in the the umbraco 8 https://papermoon.io/blog/creating-a-slider-in-umbraco/ but i do not know how add the grid to my template

    @Html.GetGridHtml(Model, "propertyAlias")

    i use this way @Html.GetGridHtml(Model, "propertyAlias") but i get an error Umbraco.Web.Mvc.ModelBindingException: Cannot bind source type Umbraco.Web.PublishedModels.Slider to model type Umbraco.Core.Models.PublishedContent.IPublishedContent.

  • Daniel Gillett 72 posts 149 karma points
    Mar 14, 2020 @ 14:11
    Daniel Gillett
    0

    Hi Ali,

    Not sure if I can help but...

    Did you name your DocType's property alias -> propertyAlias?? In my docType I called it mainGridContent - not propertyAlias. Which would explain why it cannot bind to the grid editor.

    @Html.GetGridHtml(Model, "mainGridContent", "BackStreetGrid")
    

    Also, I do not use the default grid editor (Bootstrap3.cshtml) found in Views\Partials\Grid. I created my own which is why I have a 3rd parameter.

    You can try with the default...

    @Html.GetGridHtml(Model, "mainGridContent")
    

    Hope this helps.

    Daniel

  • ali 39 posts 121 karma points
    Mar 14, 2020 @ 14:26
    ali
    0

    @Html.GetGridHtml(Model, "myGrid")

    No this how i use it

  • ali 39 posts 121 karma points
    Mar 14, 2020 @ 14:27
    ali
    0

    enter image description here

  • Daniel Gillett 72 posts 149 karma points
    Mar 14, 2020 @ 16:16
    Daniel Gillett
    0

    Hmmm...

    Ok, the only other difference that I can think off is...

    at the top of your parial view did you try adding...

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<SimplePage>
    

    This would be the DocType model.

    If that still doesn't work, you could try adding the additional parameter...

    @Html.GetGridHtml(Model, "myGrid", "Bootstrap3.cshtml")
    

    or if you want the bootstrap3 fluid optoin, then specify that one...

    @Html.GetGridHtml(Model, "myGrid", "Bootstrap3-Fluid.cshtml")
    

    Daniel

  • ali 39 posts 121 karma points
    Mar 14, 2020 @ 18:23
    ali
    0

    Thank you but i change my partial to this @inherits Umbraco.Web.Mvc.UmbracoViewPage

  • Daniel Gillett 72 posts 149 karma points
    Mar 14, 2020 @ 19:46
    Daniel Gillett
    0

    So it still does not work??

    Because your original posted error was...

    Cannot bind source type Umbraco.Web.PublishedModels.Slider

    Are you developing directly in Umbraco or do you use Visual Studio or another editor/IDE?

    Cheers Daniel

  • ali 39 posts 121 karma points
    Mar 15, 2020 @ 16:18
    ali
    0

    NO it is working now thanks after changing my partial

  • 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