Multi Site Content Provider
I have created a Calendar custom widget that uses the Events scheduled in Sitefinity. The custom Widget was designed using jQuery Full Calendar. This custom widget will be used in two different sites using a drop down list to allow user to select content site in the designer. Currently my designed only list one site, but there are two sites to pull content from, One is the Default Web Site, the other is the Sitefinity Clic Website. My code is as follows in the back end of the designer.
class EventProvider
public string ProviderName get; set;
public string SiteName get; set;
#region Methods
protected override void InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
// Place your initialization logic here
// initialize the taxonomy selectors
CategoriesSelector.TaxonomyId = TaxonomyManager.CategoriesTaxonomyId;
TagsSelector.TaxonomyId = TaxonomyManager.TagsTaxonomyId;
var multisiteContext = SystemManager.CurrentContext as MultisiteContext;
var sites = multisiteContext.GetSites().FirstOrDefault().Name;
var providers = GetProviders(typeof(EventsManager).FullName);
DropDownList SiteList = (DropDownList)this.dataSourceName;
foreach(var p in providers)
SiteList.Items.Add(p.SiteName);
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
);
#endregion
Hi,
You can use the approach described in this post to get the providers for the different sites: http://www.sitefinity.com/developer-network/forums/developing-with-sitefinity-/multisite---accessing-content-across-sites-#RWGDut_9Okai2DWQLcll-w
Regards,
Atanas Valchev
Telerik