如果控件未用 ParseChildrenAttribute 标记,或是标记为 ParseChildrenAttribute(ChildrenAsProperties = false),则当控件在页上以声明方式使用时,ASP.NET 页框架将应用以下分析逻辑。如果分析器在控件的标记内遇到嵌套控件,它将创建嵌套控件的实例并将它们添加到控件的 Controls 属性。标记之间的文本添加为 LiteralControl。任何其他嵌套元素都生成分析器错误。
如:
<SimpleControlSamples:SimpleInnerContent id="MyControl" runat=server>
我的消息在控件标记内!!!!
</SimpleControlSamples:SimpleInnerContent>
以上正确<SimpleControlSamples:SimpleInnerContent id="MyControl" runat=server>