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

Forums / Developing with Sitefinity / Getting IList of Items from multi_provider

Getting IList of Items from multi_provider

4 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    04 May 2009
    Link to this post
    Hi,

    Could you point some way to get one single IList of ItemsNews from all providers from same module using one Enumerator or other sol?. 

    Could you suggest the best way to add two or more IList of ItemsNews from not same provider Module?.

    Thanks. 
     
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    04 May 2009
    Link to this post
    Hi Pierre,

    Since you can create one instanceof the  ContentManager with one parameter as providerName you cannot get the list of items from all providers.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    04 May 2009
    Link to this post
    Hi Ivan,

    yes, but it's not possible to enumerate all provider, get for each using one instance and cumulate after in IList the Items. Regards 
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    05 May 2009
    Link to this post
    Hi Pierre,

    You can use the following approach:
    //define our list 
    List<IContent> items = new List<IContent>(); 
    //add the NewsProvider1 items 
    ContentManager m = new ContentManager("NewsProvider1"); 
    IList GC = m.GetContent(); 
    foreach (IContent item in GC) 
        items.Add(item); 
    //Add the NewsProvider2 items 
    ContentManager nm = new ContentManager("NewsProvider2"); 
    GC = nm.GetContent(); 
    foreach (IContent item in GC) 
        items.Add(item); 

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered