+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Embedding a Generic Content Control into a User Control

Embedding a Generic Content Control into a User Control

5 posts, 0 answered
  1. Andrew Hyslop
    Andrew Hyslop avatar
    21 posts
    Registered:
    23 Jun 2010
    06 Oct 2010
    Link to this post
    Hey guys / gals,

    I am in a situation where we have a complex html structure in which we need to have a generic content control.  Since this must be reusable I was thinking the best way to handle it would be to wrap the entire mess into a user control and the end user would simple drag that from the Sitefinity "Toolbox" to the desired location.  Once in place, they would be able to edit the embedded generic content control to their liking without touching the complex html structure surrounding the generic content control.  I hope I explained that enough, if not here is some psuedo code to help illustration my point:

    USER CONTROL SOURCE CODE:
    <div>
        <div>This is some static test</div>
        <div><GENERIC_CONTENT_CONTROL_HERE /></div>
         <div>This is some more static test</div>
    </div>

    Cheers :)
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    06 Oct 2010
    Link to this post
    Hello Andrew,

    I am not sure what is the idea of using Generic Content control, since it just renders text by using Render method. When you use Generic Content control the advantages are that you will be able to output resolved content and shared content. For all other cases it would be easily to create just a simple control that satisfies your needs.

    In the scenario shown by your pseudo code you  have to set the Content property of GenericContent control.

    You might find this KB useful

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Andrew Hyslop
    Andrew Hyslop avatar
    21 posts
    Registered:
    23 Jun 2010
    06 Oct 2010
    Link to this post
    Maybe I didn't explain what the end goal is properly.  The idea of using a Generic Content Control is to provide the user with a friendly user interface in which to input content when they would click "Edit".  That content would be wrapped in the complex HTML structure which I was talking about earlier.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    06 Oct 2010
    Link to this post
    Hello Andrew,

    Then you can wrap the Generic Content as shown in the KB I sent you or create  a custom control designer that uses RadEditor control

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Andrew Hyslop
    Andrew Hyslop avatar
    21 posts
    Registered:
    23 Jun 2010
    06 Oct 2010
    Link to this post
    Excellent!  Let's if I can figure this out now :)

    Thanks for the guidance
Register for webinar
5 posts, 0 answered