From b124fad4175bb28465d2c4090bf3eb052071b124 Mon Sep 17 00:00:00 2001 From: Marcus Wendt Date: Tue, 24 Apr 2012 15:49:06 +0200 Subject: [PATCH] Fixing #3926 - crach boom if use do "Add Page" and positioning = select position and Next. --- .../PageElementProvider/AddNewPageWorkflow.cs | 13 ++++++++----- .../forms/Administrative/AddNewPageStep2.xml | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/AddNewPageWorkflow.cs b/Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/AddNewPageWorkflow.cs index 60a9add2d4..9ee726897f 100644 --- a/Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/AddNewPageWorkflow.cs +++ b/Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/AddNewPageWorkflow.cs @@ -436,9 +436,12 @@ private void PrepareStep2_ExecuteCode(object sender, EventArgs e) if (this.GetBinding("SelectedSortOrder") == "Relative") { - var existingPages = - (from page in PageServices.GetChildren(GetParentId()) - select new { Title = page.Title, Id = page.Id }).ToList(); + var existingPages = new Dictionary(); + + foreach (IPage page in PageServices.GetChildren(GetParentId())) + { + existingPages.Add(page.Id, page.Title); + } if (this.BindingExist("ExistingPages") == false) { @@ -451,11 +454,11 @@ private void PrepareStep2_ExecuteCode(object sender, EventArgs e) if (this.BindingExist("RelativeSelectedPageId") == false) { - this.Bindings.Add("RelativeSelectedPageId", existingPages[0].Id); + this.Bindings.Add("RelativeSelectedPageId", existingPages.First().Key); } else { - this.Bindings["RelativeSelectedPageId"] = existingPages[0].Id; + this.Bindings["RelativeSelectedPageId"] = existingPages.First().Key; } } else diff --git a/Website/Composite/content/forms/Administrative/AddNewPageStep2.xml b/Website/Composite/content/forms/Administrative/AddNewPageStep2.xml index 26cb4d2884..06fb1442e3 100644 --- a/Website/Composite/content/forms/Administrative/AddNewPageStep2.xml +++ b/Website/Composite/content/forms/Administrative/AddNewPageStep2.xml @@ -2,7 +2,7 @@ - + @@ -29,7 +29,7 @@ - +