Gets or sets the current master item.
The current Item object.
The current master item is used in the Sitecore client. It points to the current loaded item in the content area and is set when the content area page loads.
The scope of the value is page and it is stored the Items variable "SC_CURRENT_MASTER_ITEM".
The following example processes the children of the current master item.
public void IterateChildren() {
if (State.MasterItem != null) {
SortedList list = State.MasterItem.GetChildrenSorted();
for(int n = 0; n < list.count; n++) {
IMasterItem2 child = list.GetByIndex(n) as IMasterItem2;
ProcessChild(child);
}
}
}
State Class | Sitecore.Configuration Namespace