About creating web parts

ryota kaduno asked on December 10, 2018 12:58

I would like to create a new web part with more than two zone parts.

When creating a new web part, I added the following contents in the ascx file. <asp: WebPartZone ID = "WebPartZone 1" runat = "server"> </ asp: WebPartZone>

We added a newly created web part from web part application of kentico management screen. I placed the web part on the page and found the following error "Message: A Zone can only be added to the Page in or before the Page_Init event."

How do I create an ascx file to create a web part with two or more zone parts arranged?

Recent Answers


David te Kloese answered on December 10, 2018 14:16

Hi,

What do you hope to accomplish with a Web Part zone in a Web Part itself? Is it the surrounding styling? Can't you just better use different Page Templates or Web Part Container for that?

0 votesVote for this answer Mark as a Correct answer

ryota kaduno answered on December 11, 2018 13:48

Hello, Thank you for your reply

When the editor is editing, There is a task of adding web parts into the web part zone. In order to simplify the task of adding web parts into the web parts zone, I would like to set only one web part.

Therefore, when I set up one web part when the editor edits, I would like to realize the specification that two or more web parts are set in the web part.

I will not use another page template. The Web parts container is planned to be used for the web parts zone.

How can I create an ascx file to create a web part with two or more zone parts?

0 votesVote for this answer Mark as a Correct answer

Eric Dugre answered on December 27, 2018 20:08

Ryota,

Is there a reason that the built-in layout web parts (e.g. Columns layout) don't meet your needs? Even so, you can use the code from these web parts as insipration for your own custom web parts. The Columns layout web part's code is located in \CMS\CMSWebParts\Layouts\Columns.ascx.

0 votesVote for this answer Mark as a Correct answer

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