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

Forums / Developing with Sitefinity / Using the ContentSelectorsDesignerView in a custom module

Using the ContentSelectorsDesignerView in a custom module

6 posts, 0 answered
  1. Jack
    Jack avatar
    4 posts
    Registered:
    18 Jan 2012
    19 Jan 2012
    Link to this post
    I'm trying to create a content selector using the ContentSelectorsDesignerView in a custom module. When I open the dialog it still pulls from the news provider. 

    Here's my code:
    protected override void AddViews(Dictionary<string, ControlDesignerView> views)
    {
        var contentSelectorsSettings = new ContentSelectorsDesignerView();
        contentSelectorsSettings.ContentTitleText = "ContentTitleText";
        contentSelectorsSettings.ChooseAllText = "ChooseAllText";
        contentSelectorsSettings.ChooseSingleText = "ChooseSingleText";
        contentSelectorsSettings.ChooseSimpleFilterText = "ChooseSimpleFilterText";
        contentSelectorsSettings.ChooseAdvancedFilterText = "ChooseAdvancedFilterText";
        contentSelectorsSettings.NoContentToSelectText = "NoContentToSelectText";
        contentSelectorsSettings.ContentSelector.TitleText = "TitleText";
        contentSelectorsSettings.ContentSelector.ItemType = typeof(CaseStudyItem).FullName;
     
        var testSetting = new CaseStudyContentViewDesignerView();
        testSetting.HidePrice = true;
     
        var listSettings = new ListSettingsDesignerView();
        listSettings.DesignedMasterViewType = typeof(MasterListView).FullName;
     
     
        var singleItemSettings = new SingleItemSettingsDesignerView();
        singleItemSettings.DesignedDetailViewType = typeof(DetailsView).FullName;
     
        views.Add(contentSelectorsSettings.ViewName, contentSelectorsSettings);
        views.Add(testSetting.ViewName, testSetting);
        views.Add(listSettings.ViewName, listSettings);
        views.Add(singleItemSettings.ViewName, singleItemSettings);
    }

    After reading http://www.sitefinity.com/devnet/forums/sitefinity-4-x/sdk/generic-content-marked-as-draft.aspx I tried inheriting from the ContentSelectorsDesignerView in a class inside my module, but I end up getting scripting errors when I open the dialog.

     What's the correct way to use this control?

    EDIT: I've run the sample that came in the Products module of the SDK and it has the same issue. So is this control even supported? For that matter, are custom modules actually supported? I've found the process of getting one up and running to be extremely frustrating. Is there an alternative that I should pursue?
  2. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    21 Jan 2012
    Link to this post
    Hi Jack,

     In order to change the selected content items, you need to change the ContentSelectorWebServiceUrl of the selector to point to the service url of your content type. By default this is set to the NewsItems.svc url and this is why you will always get NewsItems from the selector if you haven't changed that property.

    All the best,
    Svetoslav Petsov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. Jack
    Jack avatar
    4 posts
    Registered:
    18 Jan 2012
    31 Jan 2012
    Link to this post
    I've added the following to the contentSelectorsSettings but the problem persists:

    contentSelectorsSettings.ContentSelector.ServiceUrl = "~/Sitefinity/Services/Content/CaseStudies.svc/";

    What's the deal? Is that not the supported way of setting it?
  4. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    02 Feb 2012
    Link to this post
    Hello,

     You should change it like that:

    contentSelectorsSettings.ContentSelectorWebServiceUrl = "~/Sitefinity/Services/Content/CaseStudies.svc/";

    Kind regards,
    Svetoslav Petsov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  5. Jack
    Jack avatar
    4 posts
    Registered:
    18 Jan 2012
    02 Feb 2012
    Link to this post
    My version of SiteFinity (4.2) doesn't have the ContentSelectorWebServiceUrl property on the ContentSelectorsDesignerView class. In fact, I can't find any object with that property. Is this dialog supported in 4.2?
  6. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    06 Feb 2012
    Link to this post
    Hello Jack,

     I am sorry, I didn't realize your version was 4.2. In 4.4 contentSelectorsSettings.ContentSelector.ServiceUrl is not working, and you have to set it like I specified, but as for 4.2, I am not sure if you can change that at all (it may be a bug that is later fixed in 4.4). If setting the Url like this is not working, then you might night to inherit from that View, set the Service Url internally, and then use your view inside the designer.

    Kind regards,
    Svetoslav Petsov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
6 posts, 0 answered