Iterating Page Controls in the Order they are displayed
I'm trying to use the API to iterate over the controls on a page in the order in which they should be displayed. I'm using the following code:
Hello Shawn,
Can you try something like this:
var postsPageControl = currentPage.Controls.Cast<
PageControl
>().OrderBy(c=>c.PlaceHolder).ToList().Sort((x, y) => x.SiblingId.CompareTo(y.SiblingId));
Tried this but cannot get the correct order which the controls are displayed on the page
var controls = currentPage.Controls.Where(ctrl => ctrl.Caption.Equals("Job Profile Section"))
.OrderBy(c => c.PlaceHolder).ToList();
controls.Sort((x, y) => x.SiblingId.CompareTo(y.SiblingId));
foreach (var control in controls)
var item = pagemanager.GetControl<ObjectData>(control.Id);
var controlData = pagemanager.LoadControl(item);
var widget = controlData as MvcControllerProxy;
if (null != widget)
var values = widget.Settings.Values["Title"];
var one = values;
How does Sitefinity keep track off position of widgtes dropped on the page after they are moved up or down