Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Literal content is not allowed within a UserControl

Reply
Thread Tools

Literal content is not allowed within a UserControl

 
 
Ahsan Umair
Guest
Posts: n/a
 
      07-16-2008
Can I create a user control so that when I drop it on the web form I can put
text between the start and end tags as listed

<uc1:KeyFeatures id="KeyFeatures1" runat="server" >test..</uc1:KeyFeatures

Each one will have some lengthy text with bulleted lists, etc and I wanted
this for readability. Can I set a property to accept this "innerText" as a
value

When I do this I get

Literal content ('test..') is not allowed within a 'ASP.KeyFeatures_ascx'

I can add it as a property inside the start tag, but I wanted to do see if I
can do it this way.

Thanks, Ahsan


 
Reply With Quote
 
 
 
 
Stan
Guest
Posts: n/a
 
      07-17-2008
On 16 Jul, 15:19, "Ahsan Umair" <(E-Mail Removed)> wrote:
> Can I create a user control so that when I drop it on the web form I can put
> text between the start and end tags as listed
>
> <uc1:KeyFeatures id="KeyFeatures1" runat="server" >test..</uc1:KeyFeatures
>
> Each one will have some lengthy text with bulleted lists, etc and I wanted
> this for readability. Can I set a property to accept this "innerText" as a
> value
>
> When I do this I get
>
> Literal content ('test..') is not allowed within a 'ASP.KeyFeatures_ascx'
>
> I can add it as a property inside the start tag, but I wanted to do see if I
> can do it this way.
>
> Thanks, Ahsan


Hi Ahsan

The short answer is No.

WebUserControls do not have an implied 'Text' or 'InnerText' property
with a value that can be declared in the manner you require. If you
need a control that has properties, methods etc that are not supported
using standard controls (Labels, Textboxes etc) and want to declare
property values between the tags then you need to create a Custom
control rather than a WebUserControl.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Literal content is not allowed within a CustomControl? Dave ASP .Net Building Controls 2 08-02-2006 07:45 PM
ERROR: Literal content ('<asp:ListItem Selected="') is not allowed within a 'System.Web.UI.WebControls.ListItemCollection' (REPOST) John Smith ASP .Net 0 06-07-2006 07:24 AM
Literal content ('<asp:ListItem Selected="') is not allowed within a 'System.Web.UI.WebControls.ListItemCollection' John Smith ASP .Net 0 06-06-2006 07:58 AM
Weird error - Literal content is not allowed within a 'skin file' Alan Silver ASP .Net 1 01-26-2006 10:43 PM
"Literal content is not allowed within a user control"? =?Utf-8?B?RGF2ZQ==?= ASP .Net 0 05-17-2004 03:21 AM



Advertisments