Display same widget as a parent where both child and parent has different templates but same WebPart

Shweta S asked on June 15, 2017 23:46

I have a master page which has a webpart zone. My parent and child has a different aspx+portal type template.

If I add a widget to a parent page, is it possible for the child pages to display the same widget without manually adding it? Is there any other way to accomplish this?

Recent Answers


Trevor Fayas answered on June 16, 2017 03:42

Does the child page inherit the parent page's template, or at least use the same template?

Either way, in the Template's Design mode, if you set a webpart zone to be a widget zone, you can add a widget (in the design mode) to that zone, which means any new page that uses that page template will automatically have that widget there by default (even though you can remove it or modify it on the page level).

Does that help? otherwise can you try to clarify more?

0 votesVote for this answer Mark as a Correct answer

Shweta S answered on June 16, 2017 18:58

Hi Trevor,

Thank you for your response. Unfortunately, both of the pages have separate template so I cannot use the solution you have mentioned. Is there any control I can use on the child page that will get all widgets applied on parent page and display them on the page?

Does that help clarify the question?

Thank you!

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on June 16, 2017 19:07 (last edited on June 16, 2017 19:18)

Now I follow you, and yes you can do it. It's a bit complex, but here's the steps:

  1. Take the parent Template, and clone it (set the CodeName to something like "Parent_Widget_Zone_Only_Template")
  2. In that cloned template, remove EVERYTHING except the webpart zone that is the 'widget zone', this includes the HTML around this in the Layout. There should only be the WebpartZone control in the layout.
  3. In that cloned template's General options, set it to NOT inherit anything (no master page).
  4. On the child page, insert a Page placeholder webpart
  5. Set the path to the parent, and the Page Template to your stripped clone template (Parent_Widget_Zone_Only_Template).

HOW THIS WORKS:

The page placeholder can pull in and render a page, using a given template. Normally it shows child pages, but you can specify the page (parent), which then will render that page's content given the template.

The cloned, stripped template will only contain the widget's webpart zone of the parent, and no inheritance, so it will only render the content in there (the parent widgets).

Final Note: If you need this in a widget format, you can create a widget from the Page placeholder as you would create any widget.

0 votesVote for this answer Mark as a Correct answer

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