Sitecore TreelistEx used as a UI for multi-link layouts -
i need present content editor interface allows editors select specific pages in order generate link list website visitors.
it seems treelist/treelistex providing expected interface , have combined source path lock editors start destination rather entire sitecore tree. opted treelist ex appears efficient way doesnt render tree in full each time unless called upon.
in terms of output i'm getting pipe separated list of guids- need iterate through manually using linkmanager or such obtain items title , sitecore link? or there existing process manages such multi-list , breaks components.
if can provide example of code , how draw out title , url great.
thanks
there no built-in solution getting title , url items selected in treelist
.
you can treat treelist
field multilist
field (they both store list of pipe separated ids in background) , use getitems()
method:
sitecore.data.fields.multilistfield treelistfield = sitecore.context.item.fields["mytreelistfieldname"]; item [] selecteditems = treelistfield.getitems(); foreach (item item in selecteditems) { string itemname = item.name; string displayname = item.displayname; // fallback name if not set string title = item["title"]; // assuming there field called title string url = linkmanager.getitemurl(item); }
Comments
Post a Comment