diff --git a/components/editorControls/radiobuttonlist/RadioButtonListDataType.cs b/components/editorControls/radiobuttonlist/RadioButtonListDataType.cs index 736b49b328..9c3e78e540 100644 --- a/components/editorControls/radiobuttonlist/RadioButtonListDataType.cs +++ b/components/editorControls/radiobuttonlist/RadioButtonListDataType.cs @@ -17,7 +17,7 @@ namespace umbraco.editorControls.radiobuttonlist { if (_Editor == null) { - _Editor = new radiobox(Data,((KeyValuePrevalueEditor)PrevalueEditor).Prevalues); + _Editor = new radiobox(Data, ((KeyValuePrevalueEditor)PrevalueEditor).PrevaluesAsKeyValuePairList); } return _Editor; } diff --git a/components/editorControls/radiobuttonlist/radiobox.cs b/components/editorControls/radiobuttonlist/radiobox.cs index 0e30add344..6ce21f18ad 100644 --- a/components/editorControls/radiobuttonlist/radiobox.cs +++ b/components/editorControls/radiobuttonlist/radiobox.cs @@ -3,6 +3,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; using System.Collections; +using System.Collections.Generic; namespace umbraco.editorControls { public class radiobox : System.Web.UI.WebControls.RadioButtonList, interfaces.IDataEditor @@ -16,6 +17,13 @@ namespace umbraco.editorControls _prevalues = Prevalues; } + List> Prevalues; + public radiobox(interfaces.IData Data, List> Prevalues) + { + _data = Data; + this.Prevalues = Prevalues; + } + public Control Editor { get {return this;} @@ -40,11 +48,22 @@ namespace umbraco.editorControls protected override void OnInit(EventArgs e) { base.OnInit (e); - foreach (object key in _prevalues.Keys) - { - this.Items.Add(new ListItem(_prevalues[key].ToString(),key.ToString())); - } - + + if (_prevalues != null) + { + foreach (object key in _prevalues.Keys) + { + this.Items.Add(new ListItem(_prevalues[key].ToString(), key.ToString())); + } + } + else if (Prevalues != null) + { + foreach (KeyValuePair item in Prevalues) + { + this.Items.Add(new ListItem(item.Value, item.Key.ToString())); + } + } + try { if (_data != null && _data.Value != null) this.SelectedValue = _data.Value.ToString();