Using the ContentSelectorsDesignerView in a custom module

Posted by Community Admin on 04-Aug-2018 17:55

Using the ContentSelectorsDesignerView in a custom module

All Replies

Posted by Community Admin on 19-Jan-2012 00:00

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?

Posted by Community Admin on 21-Jan-2012 00:00

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

Posted by Community Admin on 31-Jan-2012 00:00

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?

Posted by Community Admin on 02-Feb-2012 00:00

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

Posted by Community Admin on 02-Feb-2012 00:00

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?

Posted by Community Admin on 06-Feb-2012 00:00

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

This thread is closed