Copied to clipboard

Flag this post as spam?

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


  • Dan 11 posts 82 karma points
    Sep 21, 2018 @ 10:28
    Dan
    0

    Refer layout from custom template

    Hi,

    I am trying to create an umbraco template which refers _Layout. But it gives below error when I refer _Layout.cshtml.

    Cannot bind source content type Brightwater.Application.Models.Umbraco.FAqitem to model content type Brightwater.Application.Models.Umbraco.Base.

    Any help would be really appreciated.

    Thanks!

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Sep 21, 2018 @ 10:34
    Dave Woestenborghs
    0

    Hi Dan,

    Does your layout FAqitem model inherits from the Base model

    Dave

  • Dan 11 posts 82 karma points
    Sep 21, 2018 @ 10:38
    Dan
    0

    Thanks for your reply. No it inherits from PublishedContentModel

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Sep 21, 2018 @ 10:41
    Dave Woestenborghs
    0

    Than that's the issue. You configured your layout to use a specific model.

    But your view is using a model that does not match.

    Dave

  • Dan 11 posts 82 karma points
    Sep 21, 2018 @ 10:42
    Dan
    0

    yup - I need to create a template page with same layout. Can you please let me know how can I achieve that ?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Sep 21, 2018 @ 10:43
    Dave Woestenborghs
    0

    Are you using your Base model in your _Layout ?

    Otherwise you could just define your layout with out a type specification

    @inherits UmbracoViewPage
    
  • Dan 11 posts 82 karma points
    Sep 21, 2018 @ 10:47
    Dan
    0

    Yes I am using Base model in the layout. enter image description here

    Since I am using the model inside the layout. Do you think you suggestion would work ?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Sep 21, 2018 @ 10:53
    Dave Woestenborghs
    0

    Hi Dan,

    This will probably always give errors. Because the @Model.Content.SchemaType is coming from your base model. But your FAqitem will not have this property.

    Dave

  • Dan 11 posts 82 karma points
    Sep 21, 2018 @ 10:55
    Dan
    0

    Yup - but there should be a way to create a template with layout. isnt it ? Any help would be really appreciated.

    Thanks!

  • Dan 11 posts 82 karma points
    Sep 21, 2018 @ 11:51
    Dan
    0

    I was able create a template with layout when I inherited base class in the template document type.

  • 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