How to get provider content in widget designer

Posted by Community Admin on 04-Aug-2018 15:02

How to get provider content in widget designer

All Replies

Posted by Community Admin on 06-Apr-2015 00:00

I have created a custom widget that will be used in two different sites. I have also created a custom designer for this widget that allows users to customize the widget. One of the criteria is to give the user the option on selecting the content providers for this widget. Currently I can only pull one provider name which is the default provider, the other provider is the Open Access Provider for the site. I have set permissions for both sites in the Site Management page for each site. The code populates a Drop Down List with both providers to allow for selection in designer.

 Here is my code as follows in the designer.

 var multisiteContext = SystemManager.CurrentContext as MultisiteContext;
            var sites = multisiteContext.CurrentSite.Name;
            multisiteContext.ChangeCurrentSite(multisiteContext.GetSiteByName("OtherSite"));
            var providers = multisiteContext.CurrentSite.GetProviders("ModuleName").Select(p => p.ProviderName);
            DropDownList SiteList = (DropDownList)this.dataSourceName;
            foreach(var p in providers)
           
                SiteList.Items.Add(p.ProviderName);
           
       

        IEnumerable<EventProvider> GetProviders(string dataSourceName)
       
            var sn = SystemManager.CurrentContext.CurrentSite.SiteDataSourceLinks;
            return SystemManager.CurrentContext.CurrentSite.SiteDataSourceLinks
                .Where(o => o.DataSourceName == dataSourceName)
                .Select(o => new EventProvider
                   
                        ProviderName = o.ProviderName,
                        SiteName = ((MultisiteContext)SystemManager.CurrentContext).GetSiteById(o.SiteId).Name
                   
                );
       

Posted by Community Admin on 09-Apr-2015 00:00

Hello Mauro,

you can check the following forum thread that might be helpful:

Multisite - Accessing content across sites.

Regards,
Kaloyan
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
 

This thread is closed