Custom Web Part in PageType

Larry Wildey asked on December 1, 2017 20:09

I have a custom web part that I want to be part of a new PageType. I have created the fields I need on the PageType and the web part is setup to read them but I can't figure out where to add the web part to the page type layout.

Thanks,

Larry

Correct Answer

Rui Wang answered on December 1, 2017 22:05

Are you thinking about the reverse? Like create a template with that web part and assign that template as the default template to this page type? So that way the template with this web part can read those page type field during display.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on December 1, 2017 20:12

Can you explain what your webpart does? Typically you don't directly associate a webpart with a page type.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on December 2, 2017 01:22

As Rui and Brenden mentioned you don't directly assign a web part to a page type.

You need to set up a Page template, connect it to your page. On the Page Template you can add and configure your Web Part.

Some documentation that might help you:

0 votesVote for this answer Mark as a Correct answer

Larry Wildey answered on December 4, 2017 17:35

My users want to be able to create pages with the need for me to create custom page templates each time so I was looking for a way for them to set two variable values(define what the page should display) during the page creation. The Page Type allows the users to set these values.

So it sounds like I need to create a PageTemplate without properties that I currently use for my custom webpart and set the PageType to use this PageTemplate. I will give it a try.

0 votesVote for this answer Mark as a Correct answer

Larry Wildey answered on December 4, 2017 19:43

I am getting an error "The Controls collection cannot be modified because the control contains code blocks". My guess is this is related to the lines where I am trying to grab the variables in javascript like this: var seminarType = '<%= CMS.DocumentEngine.DocumentContext.CurrentDocument.GetValue("SeminarType") %>';

0 votesVote for this answer Mark as a Correct answer

Larry Wildey answered on December 5, 2017 04:51

Thanks for the help, Page seems to be working although I am having a problem with it not showing up in the navigation. Will look into that more tomorrow.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.