Adds default value support to Checkbox data editor setting type

This commit is contained in:
starfighter83
2011-07-26 08:21:46 -02:00
parent 738380e32a
commit d8eb584d7a

View File

@@ -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;
}
}