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

Forums / Developing with Sitefinity / CssClass not working with BlogPosts Control

CssClass not working with BlogPosts Control

8 posts, 0 answered
  1. JenF
    JenF avatar
    9 posts
    Registered:
    06 Jun 2007
    04 Sep 2008
    Link to this post
    Hello,

    In Sitefinity 3.1, I created a blog for a specific section of our intranet that used different styles from blogs on other parts of the site. To do this, I used the CssClass feature under the Advanced tab of the Post Lists and Single Post controls to specify a class that was then automatically wrapped around the post output as a div tag.

    With the update to Sitefinity 3.2, I have the same class name entered into the CssClass field. However, when the page is generated, that class is not applied to the HTML output. It is missing completely.

    All of my custom styles are applied based on that overall class surrounding the post.

    Please let me know why the CssClass feature is not working with my BlogPosts control and how I can resolve this issue (short of using a generic control to wrap the whole thing in a div which seems very clunky).

    BTW, I am aware that the classes applied to the blog post dates, titles, etc. changed with the 3.2 release. I have no problem updating that in my stylesheet but first I need to have the CssClass appear in the HTML.

    Thanks,
    Jennifer
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    09 Sep 2008
    Link to this post
    Hello JenF,

    The CssClass property of the BlogPosts control is obsolete. So to achieve the required functionality we would suggest you wrap the contentplaceholder in your master page with a <div> element like this:

    .master
    <div id="Your_Css_Class">  
       <asp:contentplaceholder id="Content" runat="server"></asp:contentplaceholder> 
    </div> 

    After that you should drag and drop the BlogPosts control into the wrapped container.

    We apologize for the inconvenience caused. We have updated your Telerik account for drawing our attention to this issue.

    Sincerely yours,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. JenF
    JenF avatar
    9 posts
    Registered:
    06 Jun 2007
    09 Sep 2008
    Link to this post
    Hello,

    Why is the CssClass property obsolete? It is something we have used extensively with other controls and find it very useful.

    I appreciate your suggestion for a workaround but as I stated in my original post, I want to be able to style just this one instance of the blog control. My master page is used by hundreds of pages within my site so if I apply the class there, it will apply my unique blog styles to every page with a blog across my site. The point is that I want to be able to change the styles for just this one blog.

    Placing a class within a master page is not an equivalent replacement for the CssClass property as it does not allow styling of individual controls. A class placed in the master page will impact the entire site, not just the control that I'm trying to style.

    How can I achieve this?

    Thanks you,
    Jennifer

  4. JenF
    JenF avatar
    9 posts
    Registered:
    06 Jun 2007
    09 Sep 2008
    Link to this post
    As a followup to my previous post, I've been trying to use the Generic Content control to "wrap" the BlogPost control in an opening and closing div to apply a "wrapper" with my class. Unfortunately, the content editor always closes my div tags so I can't leave the div "open".

    If you can let me know how to override that feature so that I can have generic content with standalone opening and closing div tags, I can wrap my blog in my own custom class.

    Thanks,
    Jennifer
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    11 Sep 2008
    Link to this post
    Hi Jennifer,

    In this case you could specify a new control template for the particular instance of the Blog Posts control. Please review the attached screenshot.
    We would suggest you make a copy of the existing control templates and style them according to your needs.

    Don't hesitate to contact us if you have other questions.
    Sincerely yours,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. JenF
    JenF avatar
    9 posts
    Registered:
    06 Jun 2007
    11 Sep 2008
    Link to this post
    Thanks, I will try that.

    One suggestion -- since the feature is obsolete, it would be helpful if you would remove the CssClass field from the blog control. I wasted a lot of time trying to figure out why that class wasn't being applied. Since the field was there, I had no reason to suspect it had been deactivated.
  7. Jeremy Wadsworth
    Jeremy Wadsworth avatar
    6 posts
    Registered:
    01 Mar 2006
    11 Sep 2008
    Link to this post
    Same here. I wasted  too much time trying to use that field.

    Jeremy
  8. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    12 Sep 2008
    Link to this post
    Hi Jeremy & Jennifer,

    you are completely right and I'd like to apologize to all of you that were frustrated with the CssClass property. We are debating at the moment what to do with the CssClass property and since you seem to find this feature usable, we are thinking about a way to make it work and yet keep the markup clean.

    Perhaps we will go along the lines of displaying the control wrapper if the CssClass is set and otherwise not.

    Anyhow, thank you both for giving us a really good feedback and for your patience. Once again, I'd like to apologize if we had caused you frustrations.

    Kind regards,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
8 posts, 0 answered