Using the ContentSelectorsDesignerView in a custom module
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);
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,I've added the following to the contentSelectorsSettings but the problem persists:
contentSelectorsSettings.ContentSelector.ServiceUrl = "~/Sitefinity/Services/Content/CaseStudies.svc/";
Hello,
You should change it like that:
contentSelectorsSettings.ContentSelectorWebServiceUrl =
"~/Sitefinity/Services/Content/CaseStudies.svc/"
;
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?
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,