Jay
Jay

Reputation: 1201

Sitecore Droplist in Editing Mode

I have set Droplist field in template and set the source. I can see all list items in source path and want to generate the list in Page Editor by element.

I'd like to set different functionality between editor mode and preview mode by using "Sitecore.Context.PageMode.IsPageEditorEditing".

When the page is Editing mode, authors can see the element to choose one of the lists. If it is preview mode, authors will see the value what they chose in the editing mode element.

How can I implement??

I'm using Razor.

Upvotes: 2

Views: 1478

Answers (1)

Ian Graham
Ian Graham

Reputation: 3216

Normally in Sitecore you need an EditFrame to handle editing of Droplists in the Page editor. This however is not supported in MVC by default, but there's a great post here on how to get it working:

https://visionsincode.wordpress.com/2015/01/08/how-to-use-editframe-in-sitecore-mvc/

Alternatively you can set a 'custom experience button' to enable editors to change the droplist value when in the Page editor:

To set this up follow these steps:

  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.

Once this is setup when you edit the component and click the button editors will be able to change the value for the droplist.

Upvotes: 2

Related Questions