Computer Magic Logo
Use the partial view inside the RTE

Sunday, November 22, 2015

Published by Aristotelis Pitaridis

Sometimes we want to give the administrator of the page the ability to add forms in the Umbraco RTE. In order to do it we have to create a new Macro. Let’s create it for our contact form in order to see how to do it.

We select the Developer section and we right click the Macros node. From the list with the commands we click the Create command. In the Name textbox we type the name "Contact Form" and we click the Create button.

From the Choose a file to render area we expand the MVC Partial View drop down list and we select the ContactForm partial view. In case that we cannot see the partial view in the list we can type the path which has to be like this.

~/Views/Partials/ContactForm.cshtml

From the Editor settings area we check the "Use in rich text editor and the grid" checkbox and we click the save button which is located at the upper right corner of the browser.

Now we can insert the form in a rich text editor control.