Custom Widget with MediaContentSelectorView - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Custom Widget with MediaContentSelectorView

  • Custom Widget with MediaContentSelectorView
  • Hi,

    I am working to create a custom widget having functionality to upload the image and show that on UI. I am using MediaContentSelectorView for this purpose and facing an issue "Object reference not set to an instance of an object". I have tried many things and suggestions as found in sitefinity forums but no success.

    Then I have commented whole code related to MediaContentSelectorView except the mark up on Designer(.ascx) file but the exception is same.

    I have used this code:

    In SliderControlDesigner.ascx file:

    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Libraries.Web.UI.Designers" TagPrefix="sf" %>

    <sf:MediaContentSelectorView

      ID="SelectorView"
      runat="server"
      ContentType="Telerik.Sitefinity.Libraries.Model.Document"
      ParentType="Telerik.Sitefinity.Libraries.Model.DocumentLibrary"                                  LibraryBinderServiceUrl="~/Sitefinity/Services/Content/DocumentLibraryService.svc/"                             MediaContentBinderServiceUrl="~/Sitefinity/Services/Content/DocumentService.svc/"                             MediaContentItemsListDescriptionTemplate="Telerik.Sitefinity.Resources.Templates.Designers.Libraries.Documents.DocumentItemDescriptionTemplate.htm"
    DisplayResizingOptionsControl="false"
     ShowOpenOriginalSizeCheckBox="false">
     </sf:MediaContentSelectorView>

     

    In SliderControlDesigner.cs:

            protected virtual MediaContentSelectorView SelectorView
             

              get

               
                    return this.Container.GetControl<MediaContentSelectorView>("SelectorView", true);
               
           

    In GetScriptDescriptors() method:

    descriptor.AddComponentProperty("selectorview", this.SelectorView.ClientID);

    I have commented whole code related to MediaContentSelectorView except the mark up on SliderControlDesigner.ascx  file but the exception is same.

    I am working on sitefinity version 8.2.5900.0 .

     

    Please give me your suggestions and help me to get it resolved.

     

    Thank you,

    Prateek Tayal

     

     

     

  • Hi Prateek,

    You can check the implementation of the Image selector described in that documentation article:
    http://docs.sitefinity.com/tutorial-create-an-image-selector-for-content-items

    Regards,
    Svetoslav Manchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items