4.2 Expandable Lists

Posted by Community Admin on 04-Aug-2018 16:03

4.2 Expandable Lists

All Replies

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

After upgrading to 4.2 all of our lists in expandable mode return a Object reference not set to an instance of an object. error.  Replacing the lists doesn't fix the problem.  All of the other list modes seem to work fine.  Any ideas?

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

Have you changed the widget template at all by any chance?

This is what I have in my list template definition off a default install (back yours up before you change it FYI as we dont have template versioning yet)

<%@ Control Language="C#" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
 
<telerik:RadListView id="listsControl" runat="server"
                     ItemPlaceholderId="ListContainer"
                     EnableEmbeddedSkins="false"
                     EnableEmbeddedBaseStylesheet="false">
    <LayoutTemplate>
        <div class="sfexpandableListWrp">
            <div class="sflistExpandAllLnkWrp">
                <asp:LinkButton ID="listExpandAllLnk" runat="server" class="sflistExpandAllLnk" Text="<%$ Resources:Labels, ExpandAll %>" OnClientClick="return false;" />
                <asp:LinkButton ID="listCollapseAllLnk" runat="server" class="sflistCollapseAllLnk" style="display: none;" Text="<%$ Resources:Labels, CollapseAll %>" OnClientClick="return false;" />
            </div>
            <asp:PlaceHolder id="ListContainer" runat="server" />
        </div>
    </LayoutTemplate>
    <ItemTemplate>
            <h2 class="sflistTitle">
                <asp:Literal runat="server" Text='<%# Eval("Title") %>' />
            </h2>
            <telerik:RadListView ID="listItemsControl" runat="server"
                    ItemPlaceholderID="ItemsContainer"
                    EnableEmbeddedSkins="false"
                    EnableEmbeddedBaseStylesheet="false">
                <LayoutTemplate>
                    <ul class="sflistList">
                        <asp:PlaceHolder ID="ItemsContainer" runat="server" />
                    </ul>
                </LayoutTemplate>
                <ItemTemplate>
                    <li class="sflistListItem">
                        <h3 class="sflistItemTitle">
                            <asp:LinkButton runat="server" ID="listItemToggleLnk" class="sflistItemToggleLnk" Text='<%# Eval("Title") %>' OnClientClick="return false;" />
                        </h3>
                        <div runat="server" ID="listItemContent" class="sflistItemContent" style="display: none;">
                            <asp:Literal runat="server" Text='<%# Eval("Content") %>' />
                        </div>
                        <sf:ContentBrowseAndEditToolbar ID="BrowseAndEditToolbar" runat="server" Mode="Edit,Delete,Unpublish"></sf:ContentBrowseAndEditToolbar>
                    </li>
                </ItemTemplate>
            </telerik:RadListView>
    </ItemTemplate>
</telerik:RadListView>

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

Thank you, that fixed it.

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

Glad to hear it :)

I think there's even a reset button on the widget template screen to do that for you too...

Could I trouble you to mark this post as Answered?

Posted by Community Admin on 29-Sep-2011 00:00

I have found that if I try and delete the following portion from the Expandable List Template I get the Object reference not set to an instance of an object error. Is the only way to remove the Expand All/Collapse All links from the template to set the wrapping div to display:none?

<div class="sflistExpandAllLnkWrp">
                <asp:LinkButton ID="listExpandAllLnk" runat="server" class="sflistExpandAllLnk" Text="<%$ Resources:Labels, ExpandAll %>" OnClientClick="return false;" />
                <asp:LinkButton ID="listCollapseAllLnk" runat="server" class="sflistCollapseAllLnk" style="display: none;" Text="<%$ Resources:Labels, CollapseAll %>" OnClientClick="return false;" />
            </div>

Thanks

Posted by Community Admin on 29-Sep-2011 00:00

@Chad

Have you tried

<asp:LinkButton ID="listExpandAllLnk" .... Visible="False" />

No I have not :)  But it's running on the server so visible false should make it not render on the client while still being available to the backend (and thus not generate any extra markup with display:none)

Dont see why this wouldnt work.

Posted by Community Admin on 29-Sep-2011 00:00

@Steve

Yea, that works also, but then you have to set Visible=false in two places, and setting the wrapping div to display:none achieves the same thing. It just seems odd that with all the other Widget Templates, if you don't want a portion, you can just remove it, but with the Expandable List Template it breaks when these two link buttons aren't present.

Posted by Community Admin on 29-Sep-2011 00:00

Yeah, I'd say it's probably a bug :)  They might need to check to see if those items are not null before using them (as not everyone wants that functionality)

However it's not really the same thing as display none....I mean technically the same, but less efficient.

With display none you get the markup sent to the client so it's wasted bytes the user will never see, but pay the cost for.

This thread is closed