Where is the Layout Control Tutorial?
Can anyone post the link to the documentation tutorial that walks through creating custom layout controls? It seems the link may have changed from what it previously was.
Hello Stacey,
We did some changes to the developers guide and the articles you mention were outdated. We need to revise them, and once we are done, we'll include them in the new structure of the guide. I'm attaching the old versions that you can use, but keep in mind they are going to be expanded and rewritten.
All the best,
Slavo
the Telerik team
When attempting to create the layout control in the provided document we're getting the following error when the layout control is loaded on the site front end. The control can be successfully dragged to the page in the site administration, and content can be added to it. The error does not come up if you edit the layout control, adjusting it's column widths before publishing the page.
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
[ArgumentNullException: String reference not set to an instance of a String. Parameter name: s] System.Text.Encoding.GetBytes(String s) +9385621 Telerik.Sitefinity.Utilities.HtmlParsing.HtmlParser.Init(String html) +53 Telerik.Sitefinity.Utilities.HtmlParsing.HtmlParser..ctor(String html) +271 Telerik.Sitefinity.Abstractions.VirtualPath.SitefinityPageResolver.ProcessLayoutString(String template, PlaceHolderCursor parentPlaceHolder, CursorCollection placeholders, String layoutId) +123 Telerik.Sitefinity.Abstractions.VirtualPath.SitefinityPageResolver.AppendLayout(String layoutTemplate, String assemblyInfo, PlaceHolderCursor parentPlaceHolder, CursorCollection placeHolders, String layoutId) +494 Telerik.Sitefinity.Abstractions.VirtualPath.SitefinityPageResolver.BuildControls(PageData pageData, List`1 controlConatiners, CursorCollection placeHolders) +2026 Telerik.Sitefinity.Abstractions.VirtualPath.SitefinityPageResolver.RenderPage(StringBuilder output, PageData pageData, RequestContext context, String virtualPath) +227 Telerik.Sitefinity.Abstractions.VirtualPath.SitefinityPageResolver.Open(PathDefinition definition, String virtualPath) +301 Telerik.Sitefinity.Abstractions.VirtualPath.PathDefinition.OpenFile(String virtualPath) +67 Telerik.Sitefinity.Abstractions.VirtualPath.VirtualPathManager.OpenFile(String virtualPath) +209 Telerik.Sitefinity.Abstractions.VirtualPath.SitefinityVirtualFile.Open() +42 System.Web.Hosting.VirtualPathProvider.OpenFile(String virtualPath) +31 System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) +133 System.Web.UI.TemplateParser.ParseInternal() +86 System.Web.UI.TemplateParser.Parse() +160 System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() +110 System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) +65 System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() +218 System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +40 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +9031190 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +320 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +111 System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) +125 System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +52 System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(String virtualPath, Type requiredBaseType) +28 Telerik.Sitefinity.Web.PageRouteHandler.BuildHttpHandler(RequestContext requestContext) +1370 Telerik.Sitefinity.Web.PageRouteHandler.GetHttpHandler(RequestContext requestContext) +63 System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +8975064 System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +86 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 |
Hi Seattle Web Group,
It is hard to say what exactly is going wrong. Can you open a support ticket and send us the layout control as you have created it?
All the best,Was there any resolution for this? In the same boat.
Hello Steve,
Can you please share the Layout control you are trying to implement?
Kind regards,<%@ Control Language="C#" %>
<
section
class
=
"layoutLeft"
>
<
article
>
<
div
runat
=
"server"
class
=
"sf_cols"
>
<
div
runat
=
"server"
class
=
"sf_colsOut"
>
<
div
runat
=
"server"
class
=
"sf_colsIn"
>
</
div
>
</
div
>
</
div
>
</
article
>
<
div
class
=
"side"
>
<
div
runat
=
"server"
class
=
"sf_cols"
>
<
div
runat
=
"server"
class
=
"sf_colsOut"
>
<
div
runat
=
"server"
class
=
"sf_colsIn"
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
class
=
"clear"
></
div
>
<
div
runat
=
"server"
class
=
"sf_cols"
>
<
div
runat
=
"server"
class
=
"sf_colsOut"
>
<
div
runat
=
"server"
class
=
"sf_colsIn"
>
</
div
>
</
div
>
</
div
>
</
section
>
Hi Steve,
If the template is embedded resource without a code file that calls it out of the assembly I think it will not work properly. If you don`t need backend logic for the layout does it suit your case to register it as user control? Here is more information on custom layout controls.
All the best,
Stanislav Velikov
the Telerik team
I've read the link on custom layout controls(widgets) and that is exactly what I have done, except for item 5. For me if I specified the direct path the my layout control "Sitefinity.LayoutControls.Left.ascx" I get the odd behavior of it working in editor and preview but broken in live. However if I create a virtual path "~/Layouts/*" which is mapped to "SitefinityWebApp" and then specify the path as "~/Layouts/Sitefinity.LayoutControls.Left.ascx" it works. That is what I was trying to explain.
Additionally now that you mention it can you direct me to a code sample that does have backend logic that also does have containers. Ideally I'd like to have an .ascx.cs file do the rendering work.
thanks,
Steve
Hi Steve,
Sitefinity edit and preview use Sitefinity rendering engine, but live uses ASP.NET rendering engine.
I have attached such layout control.
To register the control add App_Code folder and place the code file in it. The template can remain in the root folder.
To register the control
ControlType: SitefinityWebApp.App_Code.Crisis, App_Code
LayoutTemplate: ~/LayoutControlTemplate.ascx
Greetings,
Stanislav Velikov
the Telerik team