-1

In Sitecore, what are the steps involved in creating a rich text editor rendering/component and having it appear on a page in the experience editor (for an ASP.NET MVC application) ?

Thank you!

Coder2013333
  • 139
  • 1
  • 9
  • 1-Created a template with 1 field of type Rich Text 2-Created a cshtml view rendering. How to code markup for this is one place I am stuck. The project uses glaxs 3-Added the rendering to the destination page's placeholder 4.Set up datasource location, allowed controls 5.Created a placeholder setting for my rendering. – Coder2013333 Feb 05 '16 at 18:34
  • When you say "glaxs" do you mean Glass Mapper? If so please try reading their tutorials. This one in particular: http://glass.lu/Mapper/Sc/Tutorials/Tutorial12 – Ben Golden Feb 05 '16 at 18:45
  • I added an answer below with the markup required. Sitecore does all the work for you. If you need more details on the template, layout setups, please let us know. – Chris Auer Feb 05 '16 at 18:50
  • Thank you for the responses. I tried the code below in my component's view and referenced the field name as shown, but I don't see anything on my page. However, I am able to add the component on my page and if I add some static text, it shows up, but the text is not editable and also no editor is available (something like a scaled down word processor right in there, as a pop up or above the text box/rich text box). The Editable checkbox in placeholder settings is checked. Part 2 of this comment is below – Coder2013333 Feb 05 '16 at 20:48
  • Also, sitecore gives me "Select the Associated Content->Select the content that you want to associate with the rendering and use as the data source." when I try to add the component in the experience editor. I had thought Sitecore would fetch an editor control for the RTE field. @dnstommy When you say "with an item that uses a template", the item in this case would be the rendering/sublayout, correct? – Coder2013333 Feb 05 '16 at 20:48
  • The component above my component was editable(a simple text field). – Coder2013333 Feb 05 '16 at 20:56
  • I had also populated the Build text box for the field in my template with '/sitecore/system/Settings/Html Editor Profiles/Rich Text Full' but it looks like that wasn't retained. I had copy-pasted that path. When I just tried to browse to it, it wasn't at that location. There was no 'html editor profiles' – Coder2013333 Feb 05 '16 at 21:03
  • Suggest you head over to [Sitecore Community Forums](https://community.sitecore.net/) for tutorial style help, people will be more than happy to help. Worth watching this set of [Youtube videos](https://www.youtube.com/watch?v=i3Mwcphtz4w) and reading through the [Community Docs](http://sitecore-community.github.io/docs/) – jammykam Feb 05 '16 at 21:56
  • Coder, you can try these links for help. This is the sitecore community MVC project. It has a lot of MVC examples and serialized data so you can build the whole site. https://github.com/Sitecore-Community/Sitecore-Mvc-Contrib If you register for this site, you can download the source. It has a package that allows you to install the who site. It also has source control that you can gather examples out of. http://www.launchsitecore.net/ – Chris Auer Feb 06 '16 at 13:57
  • @dnstommy thank you turns out I hadn't created a content item to correspond to my component. Once that was created, I was able to see the component in experience editor and add it in. Thank you all for your inputs – Coder2013333 Feb 10 '16 at 20:52
  • @Coder2013333 Glad it worked out. Remember that you can source your component from the current items fields or assign a datasource to your component and pull the data from a field in that item. – Chris Auer Feb 10 '16 at 21:48

1 Answers1

0

With an item that uses a template that has a Rich Text Field called Body, this is your rendering markup. The field is completely editable when rendered in edit mode.

@using Sitecore.Mvc
@using Sitecore.Mvc.Presentation
@model RenderingModel
<div class="row">
    @Html.Sitecore().Field("Body")
</div>
Chris Auer
  • 1,405
  • 12
  • 23