F
Frédéric Mayot
Hi,
I built a very simple templated user control but unfortunately, the template
"Content" is not recognized by intellisense and it says that my component
"SubForm" is not supposed to contain anything.
Any idea ?
Thanks
SubForm.ascx-------------------------
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SubForm.ascx.cs"
Inherits="SubForm" %>
<asp
laceHolder runat="server" ID="pl" />
SubForm.ascx.cs----------------------
public partial class SubForm : MyBaseUserControl {
protected void Page_Init() {
if (content != null) {
Content container = new Content();
Content.InstantiateIn(container);
pl.Controls.Add(container);
}
}
private ITemplate content = null;
[TemplateContainer(typeof(Content)),
TemplateInstance(TemplateInstance.Single)]
public ITemplate Content {
get { return this.content; }
set { this.content = value; }
}
}
public class Content : Control, INamingContainer{}
Using---------------------------------
<puc:SubForm runat="server">
<Content>
<asp:Label runat="server" />
something else
etc.
</Content>
</puc:SubForm>
I built a very simple templated user control but unfortunately, the template
"Content" is not recognized by intellisense and it says that my component
"SubForm" is not supposed to contain anything.
Any idea ?
Thanks
SubForm.ascx-------------------------
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SubForm.ascx.cs"
Inherits="SubForm" %>
<asp
SubForm.ascx.cs----------------------
public partial class SubForm : MyBaseUserControl {
protected void Page_Init() {
if (content != null) {
Content container = new Content();
Content.InstantiateIn(container);
pl.Controls.Add(container);
}
}
private ITemplate content = null;
[TemplateContainer(typeof(Content)),
TemplateInstance(TemplateInstance.Single)]
public ITemplate Content {
get { return this.content; }
set { this.content = value; }
}
}
public class Content : Control, INamingContainer{}
Using---------------------------------
<puc:SubForm runat="server">
<Content>
<asp:Label runat="server" />
something else
etc.
</Content>
</puc:SubForm>