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

Forums / Developing with Sitefinity / Wrap a Generic Content control

Wrap a Generic Content control

8 posts, 0 answered
  1. Court
    Court avatar
    20 posts
    Registered:
    24 Nov 2009
    19 Feb 2010
    Link to this post
    So I'm wanting to extend the Generic Content Control and wrap some custom html around the content in the Generic Content control as a custom control.

    I did find these articles:


    And was wondering which article is the best way and EASIEST way to accomplish this? Or is there even an easier way that I haven't found the article on?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Feb 2010
    Link to this post
    Hello Court,

    You should follow this article - How to wrap a Generic Content control in 3.6 SP1.
    This is the correct way to wrap Generic Content control and it will allow you full access to the control properties and the content the will be rendered.

    Best wishes,
    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. Court
    Court avatar
    20 posts
    Registered:
    24 Nov 2009
    19 Feb 2010
    Link to this post
    I followed the directions from here: http://www.sitefinity.com/support/kb/article/sitefinity-3-x/how-to-wrap-a-generic-content-control-in-3-6-sp1.aspx

    One extra setup that wasn't mention in the article was to add the control to the web.config so that it seen in Sitefinity.

    Ok so, here's the problem...

    Now when I drop the control on to a page, I can "edit" the control and I see the "Generic Content Control" WYSIWYG editor. Good. This works as expected. However, after I enter content and save it.. I see this error on the content place holder section were the control was added to in the design mode... "This control will not display properly in design mode".

    Help?


  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    21 Feb 2010
    Link to this post
    Hi Court,

    This is not an error. This is a message that is added by property of  GCWrapper when the control is initially dropped on a page

    public override string SetEmptyControlDefaultMessage()
           {
               return "This control will not display properly in design mode!";
           }

    This property sets default message for Generic Content control. If you want you can modify it through the source.


    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.
  5. Shivers999
    Shivers999 avatar
    5 posts
    Registered:
    17 Feb 2010
    06 Dec 2011
    Link to this post
    In older versions, in Design Mode, a wrapped GC control would show the wrapper and any custom properties (i.e. ContentTitle); however now it only renders the 'SetEmptyControlDefaultMessage' or the default empty GC control experience. Is there any way to code the control so that if no content is entered, the wrapper and any custom properties that get rendered will show up in design mode?
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Dec 2011
    Link to this post
    Hi Shivers999,

    This could happen if there is no text set in the control during its rendering. This is the default behavior of the ControlDesigner when the property is set. The RenderControl() method which calls RenderWithHost() of the base class are both private and this could not be changed.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Shivers999
    Shivers999 avatar
    5 posts
    Registered:
    17 Feb 2010
    07 Dec 2011
    Link to this post
    Thanks, Ivan. How about when there is text set in the control during its rendering? Even if there is content, the wrapper doesn't show when editing a page. Is there a way to change that?
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Dec 2011
    Link to this post
    Hi Shivers999,

    You can verify if the control  is empty by using .IsEmpty during its editing. It is possible that there is a bug with the example you use. This message is shown only when .IsEmpty returns true for the control.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
8 posts, 0 answered