Copied to clipboard

Flag this post as spam?

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


  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 13:55
    Christina
    0

    Modelsbuilder error with PureLive

    Hi i need some help I trying to use modelsbuilder and i'm following Umbraco.tv part working with pureLive

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    When i'm using @Model.Content.GetPropertyValue("ingress") it's working but when i'm using @Model.Content.ingress i get an error

    CS1061: Umbraco.Web.PublishedContentModels doesn't contain a definition for ingress . /C

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 02, 2018 @ 13:58
    Alex Skrypnyk
    1

    Hi Christina

    Try to use this code:

    @inherits UmbracoTemplatePage<DoctypeClass>
    

    Where doctypeClass is a class name of current doctype.

    Also, all properties should start with a capitalized first letter:

    Model.Content.Ingress
    

    Thanks,

    Alex

  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 14:09
    Christina
    0

    Thanks I tried but i got another error

    CS0246: Could not find the type or name area name Doctype Class (missing a user directive or a compilation reference?)

    I have tried to capitalize but the editor converts the first to lowercase with the padlock icon

    I have created the documenttype and associated it with the template Tema is it right? /C

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 02, 2018 @ 14:10
    Alex Skrypnyk
    0

    Yes, is Tema your doctype? Then the first line of code should be:

    @inherits UmbracoTemplatePage<Tema>
    
  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 14:13
    Christina
    0

    Thanks for helping me out

    if i use that @inherits UmbracoTemplatePage

  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 14:14
    Christina
    0

    I got the same error as in the first place/C

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 02, 2018 @ 14:14
    Alex Skrypnyk
    0

    if you use that @inherits UmbracoTemplatePage

    then you have to use this code for getting value of current page:

    @Model.Content.GetPropertyValue("ingress")
    
  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 14:15
    Christina
    0

    Yes that works/C

  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 14:22
    Christina
    0

    Thanks for helping me I'm using

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    @using ContentModels = Umbraco.Web.PublishedContentModels;

    I want to use @Model.Content.Ingress

    I can't figure out whats wrong

    /C

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 02, 2018 @ 14:24
    Alex Skrypnyk
    0

    Then add

    @inherits UmbracoTemplatePage<Tema>
    
  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 14:35
    Christina
    0

    Thanks Alex

    @inherits UmbracoTemplatePage

    @using ContentModels = Umbraco.Web.PublishedContentModels;

    Works @Model.Content.GetPropertyValue("subHeader")
    Doesn't work @Model.Content.subHeader

    Do you have any idea, whats wrong, I'm using Umbraco version 7.10.3 assembly: 1.0.6676.26622

    /C

  • Rhys Hamilton 140 posts 940 karma points
    May 02, 2018 @ 14:48
    Rhys Hamilton
    0

    Hi Christina,

    As Alex rightly pointed out, you should try to inherit from your appropriate document type (Tema) in order to access the relevant properties - keeping in mind that the alias will begin with an uppercase letter.

    Therefore, the following code snippet should work:

    @inherits UmbracoTemplatePage<ContentModels.Tema> 
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    
    @Model.Content.SubHeader 
    
  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 14:50
    Christina
    0

    Thanks for helping i have done that but it doesn't work I got error CS1061: /C

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 02, 2018 @ 14:51
    Alex Skrypnyk
    0

    Are you sure that you are working with "pureLive" mode?

  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 14:55
    Christina
    100

    Thanks for helping med The editor is not showing all of my code The

    webconfig:

      <add key="Umbraco.ModelsBuilder.Enable" value="true"/>
    <add key="Umbraco.ModelsBuilder.ModelsMode" value="PureLive"/>
    

    .NET

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2633.0
    

    /C

  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 15:01
    Christina
    0

    Big Thanks now it works /C

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 02, 2018 @ 15:23
    Alex Skrypnyk
    0

    You are welcome, happy to help.

    Alex

  • Christina 111 posts 344 karma points notactivated
    May 02, 2018 @ 16:51
    Christina
    0

    Hi again How Can i use ModeelsBuilder in a PartialView I have tried

    @inherits UmbracoViewPage<ContentModels.Tema> 
    
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    

    @Model.Content.SubHeader

    I got this Error Message: CS0122 Thanks for helping me out :) /C

  • Bo Jacobsen 438 posts 1818 karma points
    May 02, 2018 @ 18:06
    Bo Jacobsen
    0

    Hi Christina.

    How do you call your PartialView? Do you remeber to pass the model to it?

    @Html.Partial("~/Views/Partials/partial.cshtml", model)
    
  • Christina 111 posts 344 karma points notactivated
    May 03, 2018 @ 10:35
    Christina
    0

    Hi Bo I'm new to MVC and i dont understand the model. When I create documenttypes and associate them do a template is that a model? So for example if i have a documenttype title,ingress associated to home template is model = home

    Thanks /C

  • 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