Frage

I have Droplink field on template and I want allow users to select value from dropdown, but when I'm rendering field like below, dropdown is not rendering.

@Html.Sitecore().Field("Background Color")

Does sitecore really not support drop down in page editor or I'm doing something wrong? Is there any easy solution to this problem? I can't find any information about this.

War es hilfreich?

Lösung

An alternative to EditFrames is to create a 'custom experience button' for the page editor which will open a popup to allow the DropLink field to be set.

The steps are as follows:

  1. Change to Core database
  2. Create a new item under /sitecore/content/Applications/WebEdit/Custom Experience Buttons using the template /sitecore/templates/System/WebEdit/Field Editor Button
  3. In this new item, set the value of the 'Fields' field to the name of your templates DropLink field (also set appropriate icon/header/tooltip field values)
  4. Go back to the master database
  5. Select your sublayout/rendering and in the field 'Page Editor Buttons' select your newly created button item.

Now when you edit the component in the Page Editor, you should see this new button appear when the component is selected. When clicked, it will pop up a window allowing you to set the DropLink field.

Andere Tipps

What you're looking for is Edit Frames.
They allow you to define a set of fields that can then be edited from a popup window in the Page Editor.

Although a little out-dated, this blog post describes the concept.

Since you're using Razor, you will either need to use Glass (highly recommended!) to get support for the Edit Frame or use a hack.

A droplink is a field which does not have any rendering itself. This means that you can't render any html tag for a droplink. Droplink values are some kind of meta data or configuration or whatever. And because of this it's not possible to inline-edit such a field.

I would suggest you to use the ribbons on the Page Editor to create a popup where the author can easily change values for all those "hidden fields". Im pretty sure you have more than only the background color :) A good starting point is this blogpost from Adam Conn.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top