From d8eb584d7a1d392646eda103f82f38f0e95af611 Mon Sep 17 00:00:00 2001 From: starfighter83 Date: Tue, 26 Jul 2011 08:21:46 -0200 Subject: [PATCH] Adds default value support to Checkbox data editor setting type --- .../editorControls/SettingControls/CheckBox.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/editorControls/SettingControls/CheckBox.cs b/components/editorControls/SettingControls/CheckBox.cs index 22e663e1e4..42f27805f3 100644 --- a/components/editorControls/SettingControls/CheckBox.cs +++ b/components/editorControls/SettingControls/CheckBox.cs @@ -10,6 +10,8 @@ namespace umbraco.editorControls.SettingControls { private System.Web.UI.WebControls.CheckBox cb = new System.Web.UI.WebControls.CheckBox(); + private string _val = string.Empty; + public override string Value { get @@ -18,14 +20,20 @@ namespace umbraco.editorControls.SettingControls } set { - if (value == true.ToString()) - cb.Checked = true; + if (!string.IsNullOrEmpty(value)) + _val = value; } } public override System.Web.UI.Control RenderControl(DataEditorSetting sender) { cb.ID = sender.GetName(); + + if (string.IsNullOrEmpty(_val) && !string.IsNullOrEmpty(DefaultValue) && DefaultValue == true.ToString()) + cb.Checked = true; + else if(_val == true.ToString()) + cb.Checked = true; + return cb; } }