MediaContentSelectorView Conversion to 5.0 - 6.3
This post is for informational purposes. I hope it help someone out there. I've been working on upgrading a client from Sitefinity 5.0 to 6.3 and it has been going well so far. Yesterday I did run into problems on a custom module that was using a MediaContentSelectorView. Even though the code stayed exactly the same I was receiving the following error.
[NullReferenceException: Object reference not set to an instance of an object.] Telerik.Sitefinity.Modules.Libraries.Web.UI.Designers.MediaContentSelectorView.InitializeControls(GenericContainer container) +780 Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +52 System.Web.UI.Control.EnsureChildControls() +83 System.Web.UI.Control.PreRenderRecursiveInternal() +42 System.Web.UI.Control.PreRenderRecursiveInternal() +155 System.Web.UI.Control.PreRenderRecursiveInternal() +155 System.Web.UI.Control.PreRenderRecursiveInternal() +155 System.Web.UI.Control.PreRenderRecursiveInternal() +155 System.Web.UI.Control.PreRenderRecursiveInternal() +155 System.Web.UI.Control.PreRenderRecursiveInternal() +155 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974
I contacted support and learned that in Sitefinity 5.4 hierarchical libraries were introduced and I had change my selector's code to the following:
<
sf1:MediaContentSelectorView
ID
=
"backgroundSelectorView"
runat
=
"server"
ItemName
=
"Image"
ItemsName
=
"Images"
ContentType
=
"Telerik.Sitefinity.Libraries.Model.Image"
ParentType
=
"Telerik.Sitefinity.Libraries.Model.Album"
LibraryServiceUrl
=
"~/Sitefinity/Services/Content/AlbumService.svc/folders/"
MediaContentBinderServiceUrl
=
"~/Sitefinity/Services/Content/ImageService.svc/"
MediaContentItemsListDescriptionTemplate
=
"Telerik.Sitefinity.Resources.Templates.Designers.Libraries.Images.ImageItemDescriptionTemplate.htm"
DisplayResizingOptionsControl
=
"false"
ShowOpenOriginalSizeCheckBox
=
"false"
CssClass
=
"sfContentViews"
>
</
sf1:MediaContentSelectorView
>