From a4d4cbd99f21ebffa81378df90476e7ddfa54c9a Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 30 Jan 2015 15:02:21 +0100 Subject: [PATCH] U4-6034 - issue when renaming tabs --- .../umbraco/controls/ContentTypeControlNew.ascx.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs index 3a051939a5..6ad092c2b6 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs @@ -391,16 +391,21 @@ namespace umbraco.controls } } - var tabs = SaveTabs(); + var tabs = SaveTabs(); // returns { TabId, TabName, TabSortOrder } foreach (var tab in tabs) { - if (_contentType.ContentTypeItem.PropertyGroups.Contains(tab.Item2)) + var group = _contentType.ContentTypeItem.PropertyGroups.FirstOrDefault(x => x.Id == tab.Item1); + if (group == null) { - _contentType.ContentTypeItem.PropertyGroups[tab.Item2].SortOrder = tab.Item3; + // creating a group + group = new PropertyGroup {Id = tab.Item1, Name = tab.Item2, SortOrder = tab.Item3}; + _contentType.ContentTypeItem.PropertyGroups.Add(group); } else { - _contentType.ContentTypeItem.PropertyGroups.Add(new PropertyGroup {Id = tab.Item1, Name = tab.Item2, SortOrder = tab.Item3}); + // updating an existing group + group.Name = tab.Item2; + group.SortOrder = tab.Item3; } }