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

Forums / Bugs & Issues / Custom layout widget's widget-placeholder's properties cannot be edited

Custom layout widget's widget-placeholder's properties cannot be edited

2 posts, 0 answered
  1. Lasse
    Lasse avatar
    30 posts
    Registered:
    08 Jun 2012
    26 Jan 2011
    Link to this post
    Hi!

    If you create a layout widget which has custom template that includes an SF layout element (the three div's of them anyway), you can add content there as expected. However - the layout side offers you a possibility to edit the layout component's width, spacing and classnames, but these do not work and the edits are not persisted. To be specific, I wanted to be able to set the width, but noticed that even adding another classname (or removing some of them) did not take effect from the preview.

    1. create a custom layout widget which has placeholder, some inner divs and a custom template file. I provided samples underneath that should cause the bug to appear. Set the custom template itself (.ascx file) to be an embedded resource and to be returned when requested (as per the guide for custom templates shows).

    .code
    public class Box : LayoutControl
    {
        public override string Layout
        {
            get
            {
                return this.CustomTempalate;
            }
     
        }
        public override string AssemblyInfo
        {
            get
            {
                return GetType().ToString();
            }
            set
            {
                base.AssemblyInfo = value;
            }
        }
     
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
             
        }
     
        public string CustomTempalate = "SitefinityWebApp.CustomLayouts.Box.ascx";
         
        }


    .ascx:
    <%@ Control Language="C#"  %>
    <asp:PlaceHolder ID="Box" runat="server">
     
        <div class="box_wrap"  runat="server">
            <div class="box_l" runat="server">
                <div class="box_r" runat="server">
                    <div class="box_content_wrap" runat="server">
     
                      <div runat="server" class=" sf_cols ">
                            <div runat="server" class="u_inner_content_wrap sf_colsOut sf_1cols_1_100 ">
                                <div runat="server" class=" sf_colsIn sf_1cols_1_100 ">
                                </div>
                            </div>
                        </div>  
                 
                    </div>
                </div>
            </div>
            <div class="box_br" runat="server">
            </div>
        </div>
     
    </asp:PlaceHolder>

    2. add the settings to have the layout element available on the sf side

    3. drag the custom layout widget into page

    4. click on the layout's edit button

    5. set the width to some other value, change the spacing and / or add/remove classname.. (for example, trying to remove the "u_inner_content_wrap" classname that can be seen on the edit's properties)

    6. click to see preview, check the html code and notice that the changes were not carried out.
  2. Lyubomir Dokov
    Lyubomir Dokov avatar
    43 posts
    Registered:
    06 Jun 2017
    28 Jan 2011
    Link to this post
    Hello Lasse,

    I found the problem. It is in the implementation of the custom control. The Layout property must be implemented as follows:

    public override string Layout
    {
        get
        {
            var layout = this.ViewState["Layout"] as string;
            if (string.IsNullOrEmpty(layout)) {
                layout = this.CustomTempalate;
            }
            return layout;
        }
    }

    This would solve the problem with persisting the changes of the layout made from the page editor. I checked in our manual and found out that this is not covered there. We will update it.

    However, another problem exists with the template(.ascx) you posted. When you edit it from the page editor it will be truncated to the DIV that has the "sf_cols" class. The exact template you posted will be truncated after edit to this:

    <div runat="server" class="sf_cols">
        <div runat="server" class="u_inner_content_wrap sf_colsOut sf_1cols_1_100 ">
            <div runat="server" class=" sf_colsIn sf_1cols_1_100 ">
            </div>
        </div>
    </div>

    We will investigate further to see why this truncation happens. Anyway, if you put everything under the "sf_cols" div, no truncation will occur. For example:

    <%@ Control Language="C#" %>
      
    <asp:PlaceHolder ID="Box" runat="server">
        <div runat="server" class="sf_cols">
            <div runat="server" class="u_inner_content_wrap sf_colsOut sf_1cols_1_100 ">
                <div runat="server" class=" sf_colsIn sf_1cols_1_100 ">
                </div>
            </div>
            <div class="box_br" runat="server">
            </div>
        </div>
    </asp:PlaceHolder>

    I hope this helps you solve the task you are working on.


    Best wishes,
    Lyubomir Dokov
    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
2 posts, 0 answered