Internet Handholding posted on January 12, 2012 12:59
In Asp.Net 4, I have a user control for putting an email address on the page. The control looks like this.
<my:email ...>Any Text</my:email>
The problem is I get the error message
Content is not allowed between the opening and closing tags for element 'email'.
I decorated the control and property with attributes as follows, which got rid of the error message.
[
AspNetHostingPermission(SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal),
DefaultProperty("Inner_Text"),
ParseChildren(true, "Inner_Text"),
PersistenceMode(PersistenceMode.InnerDefaultProperty),
ToolboxData("<{0}:email_Control runat=\"server\"> </{0}:br_email_Control>")
]
public class br_email_Control ...
{
...
[
PersistenceMode(PersistenceMode.InnerDefaultProperty),
DesignerSerializationVisibility
(DesignerSerializationVisibility.Content)
]
public string Inner_Text { get ... set ... }
...
}