我正在创建一个自定义控件,希望获取标记中的所有内容,并将其用作控件上的字符串文本字段:
<custom:control ID="C" runat="server">This text should go into the text property</custom:control>
有人知道如何做到这一点吗?我已经在我的文本字段上尝试了以下属性(从文本控件复制),但似乎不起作用!
[DefaultValue(""), Bindable(true), Localizable(true)]
在控制类上:
[ParseChildren(true, "TextPropertyNameHere")] [PersistChildren(false)]
在控件的属性上:
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
或者类似的事情。