Prob using Document Selector - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Prob using Document Selector

  • Prob using Document Selector
  • I am trying to adapt the Custom Image Widget Sample to look for a
    document in a Library .... but when I select the document in this case a style sheet
    I get the following error in the log file.

    I tried following docs.sitefinity.com/feather-document-selector ... though was lost about step 4



    JSON

    "priority": 1,
      "components": [ "sf-document-selector" ]




    DesignerView.Simple.cshtml
    ------------------------------
    @using Telerik.Sitefinity.Mvc;

    @using Telerik.Sitefinity.Frontend.Mvc.Helpers;



    <form>
        
    <div class="form-group">
            
    <label>Choose a document:</label>


            <sf-document-selector sf-model="properties.DocumentId.PropertyValue"
                                  sf-provider="properties.DocumentProviderName.PropertyValue"
                                  sf-deselectable  />

        </div>

    </form>


    Script
    -----------
    var designerModule = angular.module('designer');
    angular.module('designer').requires.push('sfDocumentSelector', 'sfSelectors');


    Error in the logs is:
    -----------
    Type : System.Runtime.Serialization.SerializationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Message : There was an error deserializing the object of type Telerik.Sitefinity.Modules.Pages.Web.Services.Model.WcfControlProperty[]. End element 'PropertyValue' from namespace '' expected. Found element 'item' from namespace ''.
    Source : System.Runtime.Serialization
    Help link : 
    Data : System.Collections.ListDictionaryInternal
    TargetSite : System.Object ReadObjectHandleExceptions(System.Runtime.Serialization.XmlReaderDelegator, Boolean, System.Runtime.Serialization.DataContractResolver)
    HResult : -2146233076
    Stack Trace :    at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
       at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
       at System.ServiceModel.Dispatcher.SingleBodyParameterDataContractMessageFormatter.ReadObject(Message message)
       at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.DeserializeRequest(Message message, Object[] parameters)
       at System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters)
       at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

  • Hi.

    If you added this inside you widget designer

    <sf-document-selector sf-model="properties.DocumentId.PropertyValue"
                                 sf-provider="properties.DocumentProviderName.PropertyValue"
                                 sf-deselectable  />

     

    Be sure that you have this properties inside your widget controller:

    public Guid DocumentId get; set;

    public string DocumentProviderName get; set;

     

    If you still confused, you can check source code of default feather document widget here: https://github.com/Sitefinity/feather-widgets/tree/master/Telerik.Sitefinity.Frontend.Media