You are here:   Articles
  |  Login

Programming Articles

Minimize
12

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 ... }
...
}
Posted in: Asp.net

Post Rating

Comments

There are currently no comments, be the first to post one.

Post Comment

Only registered users may post comments.

Programmer Newsletter

Minimize

Subscribe to the Internet Handholding newsletter



Reccomend Programmer.bz

Minimize

Share/Bookmark Bookmark and Share