Here is my attempt:
这是我的尝试:
[DefaultProperty("Caption")]
[ToolboxData("<thp:RadioButtonListList runat=server></thp:RadioButtonListList>")]
public class RadioButtonListList : WebControl
{
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
public string Caption
{
get
{
String s = (String)ViewState["Caption"];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState["Caption"] = value;
}
}
[DefaultValue(new List<RadioButtonList>())]
[Localizable(true)]
public List<RadioButtonList> Items
{
get
{
List<RadioButtonList> l = (List<RadioButtonList>)ViewState["Items"];
return ((l == null) ? new List<RadioButtonList>() : l);
}
set
{
ViewState["Items"] = value;
}
}
protected override void RenderContents(HtmlTextWriter output)
{
output.Write("<div class=\"btn-group-vertical\" role=\"group\" aria-label=\"" + this.Caption + "\">");
foreach (var item in this.Items) {
item.RenderControl(output);
}
output.Write("</div>");
}
}
[DefaultPropert