在自建UserControl或者ServerControl过程中我们常常遇到需要调用<tag>Text</tag>中的Text值。如果不指明,asp.net会抛出 Literal Content is not allowed 错误。网上资料不多,最方便的方法是在UserControl类加上属性:
[ParseChildren(true,"<Default Property>")
]<Default Property>是Text被指定的Property name。就这么简单。
在自建UserControl或者ServerControl过程中我们常常遇到需要调用<tag>Text</tag>中的Text值。如果不指明,asp.net会抛出 Literal Content is not allowed 错误。网上资料不多,最方便的方法是在UserControl类加上属性:
[ParseChildren(true,"<Default Property>")
]<Default Property>是Text被指定的Property name。就这么简单。