@List.Toolbar Rendering Error

Feb 24, 2016 at 9:44 AM
I'm using 8.2.2 and I think I have come across a bug. I have a template that supports a List. In my template I'm also using a List Generic collection. When I try to use the snippet for showing the List Toolbar for the 2sic items, I'm getting an error rendering the template. It seems like the rendering is looking to the Generic collection for the Toolbar instead of outputting the 2sic Toolbar for managing the list. Is there something else I could be missing?
There was an error while rendering the template: System.Web.HttpCompileException (0x80004005): e:\Websites\Internal\clicksandmortarwebsites\Portals\0\2sxc\2DNN_SexyStrap\_Accordion.cshtml(13): error CS1061: 'System.Collections.Generic.List<ToSic.SexyContent.Element>' does not contain a definition for 'Toolbar' and no extension method 'Toolbar' accepting a first argument of type 'System.Collections.Generic.List<ToSic.SexyContent.Element>' could be found (are you missing a using directive or an assembly reference?) at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath) at ToSic.SexyContent.Engines.RazorEngine.CreateWebPageInstance() at ToSic.SexyContent.Engines.RazorEngine.InitWebpage() at ToSic.SexyContent.Engines.RazorEngine.Init() at ToSic.SexyContent.SexyViewContentOrApp.ProcessView(PlaceHolder phOutput, Panel pnlError, Panel pnlMessage)
Feb 24, 2016 at 10:37 AM
Please post more code, I'm guessing you forgot an AsDynamic(...) or are using in on the set-list-iterator instead of on an item or an items-list.
Feb 24, 2016 at 11:12 AM
Here's the full code sample of the template. I'm having an issue with the H3 element, that's what's throwing the error
        int rowCounter = 0;
        var mid = Dnn.Module.ModuleID;
        bool ExpandFirstPanel = false;
        if(ListPresentation.ExpandFirstPanel != null)
            Boolean.TryParse(ListPresentation.ExpandFirstPanel.ToString(), out ExpandFirstPanel);    
   <h3 class="sc-element">@List.Title @List.Toolbar</h3>
<div class="panel-group" id="SexyStrap_Accordion-@Dnn.Module.ModuleID">

    @* Build up the panels *@

    @foreach (var e in List)
        var Content = e.Content;
        var cid = Content.EntityId;

        var cssClasses = new List<string> { };
        if (rowCounter == 0)
            if (ExpandFirstPanel)

        var allCSS = new HtmlString((cssClasses.Count == 0) ? null : string.Join(" ", cssClasses));
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="SexyStrap_Accordion-@Dnn.Module.ModuleID" href="#SexyStrap_Accordion_Panel-@cid">@Content.PanelTitle
            <div id="SexyStrap_Accordion_Panel-@cid" class="@allCSS">
                <div class="panel-body">
        rowCounter = rowCounter + 1;

Feb 24, 2016 at 12:04 PM
I believe you should use ListContent.Toolbar