How to add a form bydefault to a page in Kentico 13

mahesh kulkarni asked on May 19, 2022 11:54

Hi, I have requirement to create a pagetype and Idea is that the page template will by default have a Kentico Form inserted on it.

Is there a way I can by default add a form to page when the page is created with my page type in Kentico 13? We don't want editors to add form on the page everytime they create page using this pagetype.

Thanks, Mahesh Kulkarni

Correct Answer

Arjan van Hugten answered on May 19, 2022 13:05

You can use the "RenderStandaloneWidgetAsync" method in your view. See the following documentation: https://docs.xperience.io/developing-websites/page-builder-development/rendering-widgets-in-code

0 votesVote for this answer Unmark Correct answer

Recent Answers


mahesh kulkarni answered on May 19, 2022 17:15 (last edited on May 19, 2022 17:18)

Thanks for helping out. when I try code I get error FormWidgetProperties does not exists in current context.

0 votesVote for this answer Mark as a Correct answer

Arjan van Hugten answered on May 20, 2022 11:53

You need to include the following using for the FormWidgetProperties: @using Kentico.Forms.Web.Mvc.Widgets.

0 votesVote for this answer Mark as a Correct answer

mahesh kulkarni answered on May 20, 2022 16:01

Thanks it helped me :)

0 votesVote for this answer Mark as a Correct answer

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