More in this section

Forums / Bugs & Issues / 4.2 Expandable Lists

4.2 Expandable Lists

8 posts, 1 answered
  1. Thomas
    Thomas avatar
    11 posts
    Registered:
    07 Jan 2011
    26 Sep 2011
    Link to this post
    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?
  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    26 Sep 2011
    Link to this post
    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>
    Answered
  3. Thomas
    Thomas avatar
    11 posts
    Registered:
    07 Jan 2011
    26 Sep 2011
    Link to this post
    Thank you, that fixed it.
  4. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    26 Sep 2011
    Link to this post
    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?
  5. Chad
    Chad avatar
    7 posts
    Registered:
    29 Sep 2011
    29 Sep 2011
    Link to this post
    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
  6. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    29 Sep 2011
    Link to this post
    @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.
  7. Chad
    Chad avatar
    7 posts
    Registered:
    29 Sep 2011
    29 Sep 2011
    Link to this post
    @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.
  8. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    29 Sep 2011
    Link to this post
    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.
8 posts, 1 answered