+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Custom Widget with MediaContentSelectorView

Custom Widget with MediaContentSelectorView

2 posts, 0 answered
  1. Prateek
    Prateek avatar
    4 posts
    Registered:
    05 Feb 2014
    05 Nov 2015
    Link to this post

    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

     

     

     

  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    10 Nov 2015
    Link to this post
    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
     
2 posts, 0 answered