Inner Content Property in UserControl

Posted on 2005-04-18
Last Modified: 2008-01-09

I would like to create a User Control that accepts a property between its opening and closing brackets in the htm, such that I can obtain the value in the code-behind for the control.

i.e. something like :

<MyControls:MyControl id="ctl" runat="server">
    ..some literal text here..

And ".. some literal text here.." would be accessible as a property in the control.

How would I go about implementing this within a User Control? Or is it something that is only possible with Server Controls?
Question by:pat333
    LVL 23

    Accepted Solution

    The User Control does not allow literal content between its tags....

    Author Comment

    And there is no way to circumvent this? What about nesting another control that would hold the property instead?
    LVL 23

    Expert Comment

    There's no way to circumvent this, UserControl does not accept any literal content as well as any child control.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now