W
Wes
I have created a user control in ASP.NET 2.0 that utilizes ITemplate. The
control has no issues (displays fine in a browser) until I try to go into
design mode on the aspx page that is implementing the control. The aspx page
says "Can not switch views: Content is not allowed between the openening and
closing tags for element 'Section'". I have include a simplified version of
the control and the implementation on the aspx page. Any insite into enabling
the user control for view in the design mode of an aspx page would be greatly
appreciated.
user control:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Section.ascx.cs"
Inherits="Common_FormSections_Section" %>
<hr />
<asp
laceHolder ID="contentholder" runat="server"></asp
laceHolder>
<hr />
codebehind:
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Common_FormSections_Section : System.Web.UI.UserControl
{
protected override void CreateChildControls()
{
if (null != Header)
Content.InstantiateIn(contentholder);
}
protected void Page_Load(object sender, EventArgs e)
{
}
private ITemplate _contentTemplate = null;
[TemplateInstance(TemplateInstance.Single)]
public ITemplate Content
{
get
{
return _contentTemplate;
}
set
{
_contentTemplate = value;
}
}
}
aspx implimentation:
The register tag has been intentional excluded
<uc1:Section ID="Section1" runat="server">
<Content>
This is content
</Content>
</uc1:Section>
Thanks in advance
control has no issues (displays fine in a browser) until I try to go into
design mode on the aspx page that is implementing the control. The aspx page
says "Can not switch views: Content is not allowed between the openening and
closing tags for element 'Section'". I have include a simplified version of
the control and the implementation on the aspx page. Any insite into enabling
the user control for view in the design mode of an aspx page would be greatly
appreciated.
user control:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Section.ascx.cs"
Inherits="Common_FormSections_Section" %>
<hr />
<asp
<hr />
codebehind:
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Common_FormSections_Section : System.Web.UI.UserControl
{
protected override void CreateChildControls()
{
if (null != Header)
Content.InstantiateIn(contentholder);
}
protected void Page_Load(object sender, EventArgs e)
{
}
private ITemplate _contentTemplate = null;
[TemplateInstance(TemplateInstance.Single)]
public ITemplate Content
{
get
{
return _contentTemplate;
}
set
{
_contentTemplate = value;
}
}
}
aspx implimentation:
The register tag has been intentional excluded
<uc1:Section ID="Section1" runat="server">
<Content>
This is content
</Content>
</uc1:Section>
Thanks in advance