Layout-like control
With SF4 and the new layouts...is it possible to create a usercontrol that when I drop it onto the designer I get 3 placeholders to then drop 3 other controls into?
So then at render I can place those 3 content items however I want (tabstrip, jQuery, etc)?
What I mean is, can the usercontrols embed layout controls and have SF pick that up when I plop it onto the page...
(does that make sense?)
Hi Steve,
Thank you for using our services.
In Sitefinity 4.0 we have two types of page controls - content controls and layout controls. You can create your own layout controls and add them to the layouts toolbox. Then you can drop this control on the page while in the Layout editing mode of the Page Editor. Then in Content editing mode you can add controls in your layout. This is what is available currently in the new version, I am not sure however if this is exactly what you are looking for. You can check those two help articles for more information on how to create layouts:
Layout Controls Overview
Creating Layout Controls
All the best,
Radoslav Georgiev
the Telerik team
The question was more about can i "embed" a layout control into a usercontrol such that when I drop it onto the page it gives me more content placeholders automatically...so I dont want a layout control itself, but want to leverage the ability to have that dynamic content placeholder functionality of the layout controls
Hello Steve,
Unfortunately the controls are not designed to work this way. You will have to first go to Layout - drop the layout control anywhere on the page and then go to content to put content in its placeholders.
Best wishes,
Radoslav Georgiev
the Telerik team
Hi, I've created a custom layout control, followed the steps indicated in the article and also using the existing controls as basis, but I'm having this error by the time I drag the created layout control to the page. It pops up:
Object reference not set to an instance of an object.
Please disregard my previous question. :)
However, I have a new error.
Hello jkregala,
What are the steps we can follow to replicate this error? It looks like that you use a custom Layout Controls. If so, what is the code you have?
Best wishes,
Ivan Dimitrov
the Telerik team
Basically steps 1-5 of this article: www.sitefinity.com/.../pages-layouts-creating-layout-controls.html
And then I could already see the newly-added layout template among the existing ones. I added this newly added template into my page, saved it, exited the page, and when re-opened the page, boom.
Here's my code for the ascx file:
<%@ Control Language=
"C#"
ClassName=
"Summary_8"
%>
<div runat=
"server"
id=
"content"
>
<div runat=
"server"
class
=
"group col1"
>
</div>
<div runat=
"server"
class
=
"group col2"
>
</div>
<div runat=
"server"
class
=
"group col3"
>
</div>
<div runat=
"server"
class
=
"group col4"
>
</div>
<div runat=
"server"
class
=
"group col5"
>
</div>
<div runat=
"server"
class
=
"group col6"
>
</div>
<div runat=
"server"
class
=
"group col7"
>
</div>
<div runat=
"server"
class
=
"group col8"
>
</div>
</div>
Hi jkregala,
Please take a look at this post - Issue with adding Layout Controls
Greetings,
Ivan Dimitrov
the Telerik team
I don't see how that post is related to my error. Please help. Anyway on my .ascx file (which is the base file of my custom layout control) I tried to remove ClassName="Summary_8" but I'm having this error:
Hi jkregala,
The error you see is related to the other post and I am not sure why do not use the sample code from there? You are getting a general cast exception - you cannot cast .ascx to type LayoutControl and my sample code in the other post clearly shows how to create a control that inherits from LayoutControl class. Furthermore there is a short video attached to the post that illustrates the behavior of the newly created LayoutControl.
Kind regards,
Ivan Dimitrov
the Telerik team