日期:2014-05-19  浏览次数:20362 次

复合控件 中控件属性的问题,求救
我想在一个(MyTextBox)控件中加入一下拉列表控件(ItemList)

可将   MyTextBox拖到页面,修改属性保存后到HTML模式看,却没有该属性的HTML代码

哪个高手遇到过这种问题帮指下招,路过的,求求你们,帮顶一脚,代码如下:

MyTextBox:

        [ToolboxData( " <{0}:MyTextBox   runat=server> </{0}:MyTextBox> ")]
[
ParseChildren(true),
PersistChildren(false),
Themeable(true)
]
        public   class   MyTextBox:   WebControl
        {
                [Bindable(true)]
                [Category( "Appearance ")]
                [Localizable(true)]
                public   string   Text
                {
                        get
                        {
                                String   s   =   (String)ViewState[ "Text "];
                                return   ((s   ==   null)?   String.Empty   :   s);
                        }
 
                        set
                        {
                                ViewState[ "Text "]   =   value;
                        }
                }

ItemList   myItemList=   new   ItemList();
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),NotifyParentProperty(true),PersistenceMode(PersistenceMode.InnerProperty   )]
public   ItemList   MyItemList
{
get   {   return   this.myItemList;   }
}
 
                protected   override   void   RenderContents(HtmlTextWriter   output)
                {
                        this.myItemList.RenderControl(output)
                }
        }


ItemList:


        [ToolboxData( " <{0}:ItemList=server> </{0}:ItemList> ")]
[
ParseChildren(true),
PersistChildren(false),
Themeable(true)
]
        public   class   ItemList:   WebControl
        {
                [Bindable(true)]
                [Category( "Appearance ")]
                [Localizable(true)]

ListItemCollecti