Where is the Layout Control Tutorial?

Posted by Community Admin on 03-Aug-2018 13:39

Where is the Layout Control Tutorial?

All Replies

Posted by Community Admin on 05-Apr-2011 00:00

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.

Posted by Community Admin on 06-Apr-2011 00:00

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


Posted by Community Admin on 21-Jul-2011 00:00

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.

Server Error in '/' Application.

String reference not set to an instance of a String.
Parameter name: s

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: String reference not set to an instance of a String.
Parameter name: s

Source Error:

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.

Stack Trace:

[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


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225

Posted by Community Admin on 26-Jul-2011 00:00

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,
Slavo
the Telerik team
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

Posted by Community Admin on 28-Oct-2011 00:00

Was there any resolution for this?  In the same boat.

Posted by Community Admin on 02-Nov-2011 00:00

Hello Steve,

Can you please share the Layout control you are trying to implement?

Kind regards,
Slavo
the Telerik team
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

Posted by Community Admin on 02-Nov-2011 00:00

<%@ 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>

The layout control is fine.  Sitefinity just didn't work in "live" if you specified the LayoutTemplate as the direct embedded resource "SitefinityWebApp.LayoutControls.Left.ascx" however it worked in editor and preview.

It does however work in editor, preview, and live if you create a VirtualPathSettings->VirtualPath, in my case "~/Layouts/*", and then use that virtual path to the embedded resource "~/Layouts/SitefinityWebApp.LayoutControls.Left.ascx"

The behavior is confusing, but I'm just glad its working now.

Posted by Community Admin on 03-Nov-2011 00:00

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

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

Posted by Community Admin on 03-Nov-2011 00:00

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

Posted by Community Admin on 08-Nov-2011 00:00

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

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

This thread is closed