From 0f84165b2be1c3399243275b46ab6bd652a2c4ae Mon Sep 17 00:00:00 2001 From: starfighter83 Date: Tue, 26 Jul 2011 08:15:28 -0200 Subject: [PATCH] Adds default value support to ListBox and ListBoxMultiple data editor setting types --- components/editorControls/SettingControls/ListBox.cs | 5 ++++- .../editorControls/SettingControls/ListBoxMultiple.cs | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/components/editorControls/SettingControls/ListBox.cs b/components/editorControls/SettingControls/ListBox.cs index 1202d00a84..0f396af012 100644 --- a/components/editorControls/SettingControls/ListBox.cs +++ b/components/editorControls/SettingControls/ListBox.cs @@ -37,7 +37,10 @@ namespace umbraco.editorControls.SettingControls lb.Items.Add(s); } - lb.SelectedValue = _val; + if (string.IsNullOrEmpty(_val) && !string.IsNullOrEmpty(DefaultValue)) + lb.SelectedValue = DefaultValue; + else + lb.SelectedValue = _val; return lb; } diff --git a/components/editorControls/SettingControls/ListBoxMultiple.cs b/components/editorControls/SettingControls/ListBoxMultiple.cs index 832206d7a7..a4fa5b7db7 100644 --- a/components/editorControls/SettingControls/ListBoxMultiple.cs +++ b/components/editorControls/SettingControls/ListBoxMultiple.cs @@ -45,14 +45,13 @@ namespace umbraco.editorControls.SettingControls if (_val.Contains(s + ";")) item.Selected = true; - + lb.Items.Add(item); - - } - + if (string.IsNullOrEmpty(_val) && !string.IsNullOrEmpty(DefaultValue)) + lb.SelectedValue = DefaultValue; return lb; }