Custom layout properties
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
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
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
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
I'm sure it will. Thanks for taking the time to help me.
Stuart
Hi Daniel,
I'm sure it will. Thanks for taking the time to help me.
Stuart
Hi Stuart,
Check this post: www.sitefinity.com/.../contentplaceholder-in-usercontrol
It maybe close to what you need.
Kind regards,
Daniel
* If this post helped you, please mark it as answered.
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
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,