【发布时间】:2014-01-21 00:26:05
【问题描述】:
我正在尝试创建自定义 RadioButtonGroup 控件并向此控件添加自定义 ListItemCollection 属性,我已经添加了此属性,但我的问题是: 我将控件拖到我的网页上,然后打开该控件的检查器并将项目存储在我的自定义列表(3 个项目)中,当我运行我的页面并访问此列表时,我发现它的 count=0 我不知道为什么?
这是我的代码:
public class BaccahRadioGroup : RadioButtonList, INamingContainer
{
private ListItemCollection englishList; /// this is my custom list
[Bindable(true)]
[Localizable(true)]
[Category(category)]
public virtual ListItemCollection EnglishList {
get
{
if (englishList == null)
{
englishList = new ListItemCollection();
((IStateManager)englishList).TrackViewState();
}
return englishList;
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
}
}
}
【问题讨论】:
标签: c# asp.net custom-controls