Reputation: 1201
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
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:
/sitecore/content/Applications/WebEdit/Custom Experience Buttons
using the template /sitecore/templates/System/WebEdit/Field Editor Button
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