More in this section

Forums / Developing with Sitefinity / CSSClass on ContentView

CSSClass on ContentView

2 posts, 0 answered
  1. Sheridan
    Sheridan avatar
    13 posts
    02 Jul 2008
    16 Jul 2008
    Link to this post
    I am trying to figure out a way to set a CSSClass around a Generic_Content.  My intention is to be able to have different Generic_Content items on a single page that are treated differently in CSS.

    I figured out how to set the class="" in the Masterpage, but this affects everything.

    I need to make a Generic_Content item "MyItem1" and set a CSSClass property to "QuoteText" and have it co-exist with other Generic_Content items that were dropped on the same page that don't have that class.

    Any ideas would be greatly appreciated.
  2. Katia
    Katia avatar
    194 posts
    01 Jul 2016
    18 Jul 2008
    Link to this post
    Hello Sheridan,

    You can make a user control that will wrap Generic Content and will add div with a specific class name around Generic Content. So you will be able to style Generic Content differently when inserted through that control as you write more specific CSS rules in your site theme.

    I have attached a sample control that you can use. So copy this control to your project. After that open web.config and find toolboxControls section. Add the control to page toolbox like that:

    <add name="Quote Box" section="Most popular" url="~/UserContrls/QuoteTextGenericContent.ascx" description="A quote text generic content box." /> 

    Make sure you have set the right url to the control.

    After that, "Quote Box" control should appear in the "Most popular" control section along with Generic Content, Image and Images Gallery.

    I have set class name QuoteText to the div that wraps the Generic Content. You can change it to whatever you want in QuoteTextGenericContent.ascx.

    All the best,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
2 posts, 0 answered