How to Use Droplist Types in Sitecore Template Fields

Is there anyone who knows how to use the "Droplist" type in the template fields?

I think the "Droplist" is the same as the type <select><option></option></select>.

I would like to specify list types with static values ​​so that Sitecore editors can select only one of the many available lists when creating the page. My plan is to add CSS ( <option>) class names to list ( <select>), and editors will use one of the styles by selecting one of them.

How to add values ​​to the selection list? Should I write code?

+4
source share
2 answers

Droplist Droplink, . Droplist ( ), Droplink . , , Droplist ( ), Droplink .

Droplist, Datasource - ( /sitecore/content/Home/CSS/, CSS).

Droplist :

Item item = Sitecore.Context.Item;
string css = item["FieldName"]; // Also possible is item.Fields["Fieldname"].Value;

A Droplink :

string dropDownItemId = item["Fieldname"]; // Or, again, item.Fields["Fieldname"].Value; if you prefer
var cssItem = Sitecore.Context.Database.GetItem(dropDownItemId); // And now you can
// access any fields in this item.

Edit , Droplink Droplist

+8

, @Trayek . , :

, , CSS-, , , Value. , CSS .

- , CSS- . droplist/droplink.

, . 1 ( ). , , , .

enter image description here

+3

All Articles