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

Forums / Developing with Sitefinity / Custom layout properties

Custom layout properties

9 posts, 0 answered
  1. Stuart
    Stuart avatar
    10 posts
    Registered:
    02 Dec 2011
    29 May 2013
    Link to this post
    Hi all,

    I'm brand new to developing in Sitefinity. We're using version 6. I've been charged with the task of creating a custom layout, which I've done with the Thunder extension in VS2010:

    <div runat="server" class="sf_cols">
        <div runat="server" class="sf_1col_1_100">
            <div runat="server" class="sf_colsIn sf_1col_1in_100">
            <!-- Place holder goes here! -->

            </div>
        </div>
        <div runat="server" class="sf_1col_1_100">
            <div runat="server" class="sf_colsIn sf_1col_1in_100" style="text-align:center">            
            </div>
        </div>
    </div>

    I've been told that I can extend the custom layout to add extra properties (I need two... Anchor and NextAnchor. Basically, what I'm trying to achieve is to create a layout the user can drag onto the page. The user can then add widgets into this layout. There will be multiple custom layouts on the page, but each layout references the next by the two properties. So ...

    CustomLayout1 (includes eg 3 widgets)
    CustomLayout2 (includes eg 3 widgets) 
    etc..

    When the user clicks a button in CustomLayout1, it needs to read the NextAnchor property (which contains eg CustomLayout2), and then slide down to CustomLayout2.

    Problem is I can't seem to figure out how the user would enter the Anchor or NextAnchor values. I tried setting up Toolbox item parameters (as seen in Snap1.png attached). I would have expected them to have an effect on the edit when the layout tool is placed (snap2.png attached), but it didn't. I'm not sure how to achieve what I need.

    Any help would be very greatly appreciated. 

    Thanks in advance

    Stu
  2. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    30 May 2013 in reply to Stuart
    Link to this post
    Hi Stuart,

    You can create your own control by inheriting from the LayoutControl class.
    I think you can then create some logic to navigate through some containers using jQuery?

    Kind regards,
    Daniel
  3. Stuart
    Stuart avatar
    10 posts
    Registered:
    02 Dec 2011
    30 May 2013
    Link to this post
    Hi Daniel,

    Thanks for taking the time to reply and point me in the right direction. I've tried to setup as you've suggested (setup.png & registration.png attached), but when I drag the control onto the page, I get an all too familiar .net "Object reference not set to an instance of an object" error popup message. I've obviously not configured or set something up correctly. I'm hoping the attached files give you a flavour of what I'm trying to do.

    Any help would be very appreciated; really struggling on this one!

    Thanks

    Stu
  4. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    30 May 2013 in reply to Stuart
    Link to this post
    Hi Stuart,

    I've not tested this out myself, but you need to register this type of control as a Layout Widget, not a normal widget. See this link for more information about that. http://www.sitefinity.com/documentation/documentationarticles/designer-s-guide/custom-layout-widgets

    Of course you're dealing with a class and not a UserControl, so you have to use the Assembly name and Namespace to register your control.

    Can't give you any more details at this moment, sorry! Hope this helps.

    Kind regards,
    Daniel
  5. Stuart
    Stuart avatar
    10 posts
    Registered:
    02 Dec 2011
    30 May 2013
    Link to this post
    I'm sure it will. Thanks for taking the time to help me.

    Stuart
  6. Stuart
    Stuart avatar
    10 posts
    Registered:
    02 Dec 2011
    30 May 2013
    Link to this post
    Hi Daniel,

    I'm sure it will. Thanks for taking the time to help me.

    Stuart
  7. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    30 May 2013 in reply to Stuart
    Link to this post
    Hi Stuart,

    Check this post: http://www.sitefinity.com/developer-network/forums/suggestions---/contentplaceholder-in-usercontrol#CjENizKucUSaFbS_fH_T0Q

    It maybe close to what you need.

    Kind regards,
    Daniel

    * If this post helped you, please mark it as answered.
  8. Stuart
    Stuart avatar
    10 posts
    Registered:
    02 Dec 2011
    31 May 2013
    Link to this post
    Hi Daniel,

    I've come to the conclusion that Sitefinity isn't flexible enough for me to be able to do what I need to. I've formulated a backup plan that involves putting my current/next in the css wrapper section of the layout options and parsing/dealing with that in jquery. Bit messy but would appear to be my only option as far as I can tell. 

    Just wanted to wrap this up and to say thanks for taking the time to help me out.

    Cheers

    Stu
  9. Jen Peleva
    Jen Peleva avatar
    568 posts
    Registered:
    10 Nov 2016
    03 Jun 2013
    Link to this post
    Hello guys,

    Adding a designer to a layout control will not work, since the initial idea of layout controls is not to execute any code. They are actually containers for information - placeholders. This is why even if you add a designer to a layout control it will not work in the page editor. This would only break their existing functionality.

    Regards,
    Jen Peleva
    Telerik
    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
9 posts, 0 answered