Copied to clipboard

Flag this post as spam?

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


  • Christina 127 posts 390 karma points notactivated
    May 21, 2018 @ 14:18
    Christina
    0

    Change doctype on a page

    Hi I cant change doctype on an existing page, but i can create a new in the same level with the the other doctype. I want to change a contentpage to a listpage, i have set permission and if I alllow doctype contentPage templates on ListPage i get error. Many thanks /Christina

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    May 21, 2018 @ 14:28
    Alex Skrypnyk
    0

    Hi Christina

    What error did you get?

    Thanks,

    Alex

  • Christina 127 posts 390 karma points notactivated
    May 21, 2018 @ 14:31
    Christina
    0

    Hi Alex I got this error Cannot bind source content type Umbraco.Web.PublishedContentModels.ContentPage to model content type Umbraco.Web.PublishedContentModels.ListPages. But if i Move the contentpages everything works /Christina

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    May 21, 2018 @ 14:47
    Alex Skrypnyk
    0

    It's because your template is waiting for ContentPage page model, and you pass ListPages model.

    You have to change templates code to be universal.

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    May 21, 2018 @ 14:47
    Alex Skrypnyk
    0

    Can you show razor code?

  • Christina 127 posts 390 karma points notactivated
    May 22, 2018 @ 06:26
    Christina
    0

    Thanks a lot here is the code

        @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ListPages>
        @using ContentModels = Umbraco.Web.PublishedContentModels;
    
        @{
         var list = Model.Content.Children<ContentPage>().Where(x => x.IsVisible());
         foreach (ContentPage item in list)
         {    
          <div class="columns">
    
           <div class="column">
             <h3>
             @item.Name
             </h3>          
          </div>             
         </div>
       }
    

    }

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    May 22, 2018 @ 16:12
    Alex Skrypnyk
    0

    Glad that topic is solved, have a nice day!

Please Sign in or register to post replies

Write your reply to:

Draft