Literal content is not allowed within a UserControl

Discussion in 'ASP .Net Web Controls' started by Ahsan Umair, Jul 16, 2008.

  1. Ahsan Umair

    Ahsan Umair Guest

    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
     
    Ahsan Umair, Jul 16, 2008
    #1
    1. Advertising

  2. Ahsan Umair

    Stan Guest

    On 16 Jul, 15:19, "Ahsan Umair" <> 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.
     
    Stan, Jul 17, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGF2ZQ==?=

    "Literal content is not allowed within a user control"?

    =?Utf-8?B?RGF2ZQ==?=, May 17, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,115
    =?Utf-8?B?RGF2ZQ==?=
    May 17, 2004
  2. Alan Silver
    Replies:
    1
    Views:
    7,220
    Alan Silver
    Jan 26, 2006
  3. John Smith
    Replies:
    0
    Views:
    4,896
    John Smith
    Jun 6, 2006
  4. John Smith
    Replies:
    0
    Views:
    1,305
    John Smith
    Jun 7, 2006
  5. Dave

    Literal content is not allowed within a CustomControl?

    Dave, Aug 2, 2006, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    659
Loading...

Share This Page