4.2 Expandable Lists
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?
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
>
Thank you, that fixed it.
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?
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
>
@Chad
Have you tried
<
asp:LinkButton
ID
=
"listExpandAllLnk"
....
Visible
=
"False"
/>
@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.
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.