Issue with adding Layout Controls
Hi,
Hi Seth Cleaver,
I checked the article and it is valid for the BETA. Make sure that you have added valid relative paths to the ascx file and you have build the application before trying to add the layout control on a page.
When you use custom class library you have to set
ControlType - type of your class library for instance -Telerik.Samples.LayoutControl, Telerik.Samples
LayoutTemplate - location to the embedded template.
sample
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Web.UI;
using
Telerik.Sitefinity.Web.UI;
namespace
Templates
class
Class1 : 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 =
"Templates.Layouts.Column1Template.ascx"
;
In the video, are "CustomLayout" and "LayoutControl" in any way related? And BTW, what does this mean? "...you have build the application before trying to add the layout control on a page..."
Hello jkregala,
The video shows that LayoutControl is a custom page layout. "LayoutControl" is the Title of Templates.Class1.
When you work with web application, you have to build the solution or restart it with a dummy change in the web.config, otherwise the changes you have made would not apply.
Kind regards,
Ivan Dimitrov
the Telerik team
Hi, in the video, I did not see any reference to any physical file for the custom control "LayoutControl" in the LayoutTemplate field. (Under Administration - Tools - so on). Was the code you sampled meant to be placed in a physical .ascx file?
Hello jkregala,
The class is registered in Toolboxes >> PageLayouts section and this is shown in the video.
Best wishes,
Ivan Dimitrov
the Telerik team
Error
Could not load file or assembly 'Templates' or one of its dependencies. The system cannot find the file specified.
Did exactly what was in the video
Hi Ivan, a colleague of mine came to my rescue and now we're no longer having these problems.
Anyway, how do I let these things appear? Kindly see screenshot. They are vital for the placement of Content Controls. Thanks :)
Hello jkregala,
Thsi is a layout element which has 4 containers, so each of them should be 25%. You can use the following CssClass when you add your new tool and below is a sample template
<%@ Control Language="C#" %>
<
div
runat
=
"server"
class
=
"sf_cols"
>
<
div
runat
=
"server"
class
=
"sf_colsOut sf_4cols_1_25"
>
<
div
runat
=
"server"
class
=
"sf_colsIn sf_4cols_1in_25"
>
</
div
>
</
div
>
<
div
runat
=
"server"
class
=
"sf_colsOut sf_4cols_2_25"
>
<
div
runat
=
"server"
class
=
"sf_colsIn sf_4cols_2in_25"
>
</
div
>
</
div
>
<
div
runat
=
"server"
class
=
"sf_colsOut sf_4cols_3_25"
>
<
div
runat
=
"server"
class
=
"sf_colsIn sf_4cols_3in_25"
>
</
div
>
</
div
>
<
div
runat
=
"server"
class
=
"sf_colsOut sf_4cols_4_25"
>
<
div
runat
=
"server"
class
=
"sf_colsIn sf_4cols_4in_25"
>
</
div
>
</
div
>
</
div
>
Thanks much, that worked! :)