扩展 PlaceHolder 的自定义控件被标记为 ParseChildren(true)。本地化不起作用
我声明了一个自定义控件,
[SupportsEventValidation, DefaultEvent("ActiveTabChanged")]
[ParseChildren(true)]
[PersistChildren(false)]
[ToolboxBitmap(typeof(System.Web.UI.WebControls.Panel))]
public class TabContainer : System.Web.UI.WebControls.PlaceHolder, INamingContainer, IPostBackDataHandler, IPostBackEventHandler
{
当我在代码标记中使用它时,我使用它,因为
<MDSL:TabContainer runat="server" ID="t1">
<ClientEvents>
<TabChange EventHandler="onTabChanged" />
<Load EventHandler="onTabLoaded" />
</ClientEvents>
<Tabs>
<MDSL:Tab ID="tablInvoice" runat="server" HeaderText="Invoice">
<ContentTemplate>
<MDSL:TextBox ID="TextBox1" runat="server" Text="in new tab"></MDSL:TextBox>
</ContentTemplate>
</MDSL:Tab>
<MDSL:Tab ID="tabTzhirdTab" runat="server" HeaderText="My new Shiny Header Text">
<ContentTemplate>
<MDSL:Label ID="lbldNew" runat="server" Text="Woohhoo!!" DataField="" DataFormatString=""
meta:resourcekey="lbldNewResource5"></MDSL:Label>
</ContentTemplate>
</MDSL:Tab>
</Tabs>
</MDSL:TabContainer>
一切都按照我的预期运行良好。但是,如果我进入设计视图并执行“工具 -> 生成本地资源”,那么几乎什么都不会发生:(但是,如果我将其标记为
ParseChildren(false)
,那么元标记就会出现,一切都会按照我的预期发生有人可以帮我吗
? 尼克
I have a a custom control declared as
[SupportsEventValidation, DefaultEvent("ActiveTabChanged")]
[ParseChildren(true)]
[PersistChildren(false)]
[ToolboxBitmap(typeof(System.Web.UI.WebControls.Panel))]
public class TabContainer : System.Web.UI.WebControls.PlaceHolder, INamingContainer, IPostBackDataHandler, IPostBackEventHandler
{
when I use this in my code markup, I use it as
<MDSL:TabContainer runat="server" ID="t1">
<ClientEvents>
<TabChange EventHandler="onTabChanged" />
<Load EventHandler="onTabLoaded" />
</ClientEvents>
<Tabs>
<MDSL:Tab ID="tablInvoice" runat="server" HeaderText="Invoice">
<ContentTemplate>
<MDSL:TextBox ID="TextBox1" runat="server" Text="in new tab"></MDSL:TextBox>
</ContentTemplate>
</MDSL:Tab>
<MDSL:Tab ID="tabTzhirdTab" runat="server" HeaderText="My new Shiny Header Text">
<ContentTemplate>
<MDSL:Label ID="lbldNew" runat="server" Text="Woohhoo!!" DataField="" DataFormatString=""
meta:resourcekey="lbldNewResource5"></MDSL:Label>
</ContentTemplate>
</MDSL:Tab>
</Tabs>
</MDSL:TabContainer>
Everything works fine as I would expect it to. However if I go to design view and do a "Tools -> Generate Local Resources" then pretty much nothing happens :( If I however mark this as
ParseChildren(false)
then the meta tags appears and everything happens as I would expect it to happen. Can anyone help me here?
Thanks!
Nik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己解决了。这是我处理 CreateControlCollection() 方法重写的方式。我需要在设计视图中对此方法进行一些特殊处理。然后,我还需要在控件的一些公共属性上正确使用
DesignerSerializationVisibility
属性。Solved it myself. It was the way I was handling the override of
CreateControlCollection()
method. I needed some special handling of this method in the design view. Then I also needed to use theDesignerSerializationVisibility
attribute correctly on a few public properties of the control.