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

Forums / Designing with Sitefinity / Control Container like in DNN

Control Container like in DNN

9 posts, 0 answered
  1. Daniel Lang
    Daniel Lang avatar
    8 posts
    Registered:
    26 Nov 2009
    01 Dec 2009
    Link to this post
    Dear All!

    I'm just getting started using Sitefinity and would like to port an existing DotNetNuke5 - website.
    One major problem is, that I cannot find something similar to the Conatiner-Skins in DotNetNuke.

    Let's assume I have a website with green background-color and would like to "wrap" all the controls (generic content, newsview, blog, etc.) inside white rounded boxes.

    Is there an easy way to do that?
    I have already read several articles about wrapping an embedded control into a custom control and applying themes, but all far from being easy.

    Thank you!
    Daniel Lang
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    01 Dec 2009
    Link to this post
    Hello Daniel Lang,

    There are two options that I could come now.

    1. Style each control through css. You can use built in CssFileLink control inside each template.
    2. Apply some css on each ContentPlaceHolder. By doing so each control dropped to a ContentPlaceHolder will be styled depending on your css.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Daniel Lang
    Daniel Lang avatar
    8 posts
    Registered:
    26 Nov 2009
    01 Dec 2009
    Link to this post
    Hello Ivan!

    Thank you for your answer. As I see, your second approach is exactly what I would like to do. All kind of controls should be rendered inside such boxes, but these boxes are only visible if there is a control in them. Then I could create 5 or more contentplaceholder in the sidebar on my masterpage, and eventually fill them on a per-page basis.

    Could you please provide an example of how such a css-class could look like in order to place a containing-box around a control? Please remember, to get rounded edges I'm using seperate image-files... Altough I have some CSS-experiences I don't know a way to do all this in just one css-class.

    Best regards,
    Daniel Lang
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    02 Dec 2009
    Link to this post
    Hi Daniel Lang,

    Below is a very simple code that adds a frame around a ContentPlaceHolder.

    <div id="SideBar" style="border-color:Red; border-width:5px; border-style:solid"><asp:contentplaceholder id="SideBarContent" runat="server">

    If you want to use roundedcorners you need to draw appropriate images and then use css to style the ContentPlaceHolder. You can observer the main Sitefinity.com page ( news tab)  where you will find similar implementation. Another useful link : rounded_corners_in_css

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Daniel Lang
    Daniel Lang avatar
    8 posts
    Registered:
    26 Nov 2009
    02 Dec 2009
    Link to this post
    Thank you for the code provided!

    Please correct me if I'm wrong, but I think that using a surrounding div-Container means that the containing-box will also be visible on the page, even if the sitefinity-page doesn't place any content into the ContentPlaceholder... ?

    Let's assume I have a two column-layout, where the sidebar could hold up to 5 boxes. I place a div-Container around each of these 5 boxes. Then I created a single template based on this single master-file, but without placing content inside these "side-boxes" in the template. The sitefinity-pages, which use this template place their own controls inside the sideboxes. Some pages make use of all 5 placeholder, some only use 2 or 3.
    --> How can I "hide" the surrounding content-boxes in case the contentplaceholder isn't used?

    I know - a workaround would be, to create different .master-pages and template for each number of sideboxes, but that doens't seem to be a best-practise-solution...
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    04 Dec 2009
    Link to this post
    Hi Daniel Lang,

    You can get the contentplace holder from the master page and check whether it has controls or not. You have to set id and runat attribute to the div.If there are controls in the holder - just show the div, otherwise hide it.

    protected void Page_Load(object sender, EventArgs e)
    {
        ContentPlaceHolder holder = this.FindControl("SideBarContent") as ContentPlaceHolder;
        if (holder != null && holder.Controls.Count == 0)
        {
            SideBar.Visible = false;
     
        }
         
    }

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Daniel Lang
    Daniel Lang avatar
    8 posts
    Registered:
    26 Nov 2009
    04 Dec 2009
    Link to this post
    Thank you for all your help!

    This is exactly what I was looking for!

  8. Daniel Lang
    Daniel Lang avatar
    8 posts
    Registered:
    26 Nov 2009
    10 Dec 2009
    Link to this post
    Just for info...

    I have found an even more comfortable way to bring-in DotNetNuke-like containers. I just needed to create a custom user control, which wraps a GenericContent-control. Inside my .ascx-file I place the appriopriate div-containers round the content-placeholder.

    A really good explanation can be found here:
    http://www.sitefinity.com/help/developer-manual/how-to-gc-add-content-to-user-control.html


  9. GCM
    GCM avatar
    11 posts
    Registered:
    29 Jul 2007
    03 Sep 2010
    Link to this post
    sorry, didn't mean to post this...
Register for webinar
9 posts, 0 answered