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

Forums / General Discussions / Find the content inside a PageNode

Find the content inside a PageNode

7 posts, 0 answered
  1. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    27 Jan 2011
    Link to this post
    Hello,
    I've got a pageNode found using

    IQueryable<PageNode> page = App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Where(o1=>o1.Title == "DetailPage").Get();

    How Do I get the News and the DownloadList item I got inside?

    Ho do I bind an IQueryable<NewsItem> to the News object?
    Thanks

  2. Ilaria
    Ilaria avatar
    25 posts
    Registered:
    20 Jan 2011
    28 Jan 2011
    Link to this post
    Hello,
    sorry, but we need this information as soon as possible, cause we have to give the demo to the customer on monday..
    any suggestion please?

    Thanks a lot
    Ilaria
  3. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    28 Jan 2011
    Link to this post
    Hello,
    I've done some success but not much ....... I've got the controls in this way :

     
    IQueryable<PageNode> page = App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Where(o1=>o1.Title == "DetailPage").Get();
             PageNode pageNode = page.FirstOrDefault();
     
             PageData pageData = pageNode.Page;
     
             var newsViewUserControl = pageData.Controls.Where(o1 => o1.ObjectType == STR_NEWS_TYPE).FirstOrDefault();
             var downloadViewUserControl = pageData.Controls.Where(o1 => o1.ObjectType == STR_DOC_TYPE).FirstOrDefault();

    now I wish to set the "DataSource" of those this two items with the data I got querying the news /document using
    App.WorkWith().NewsItems().Get();

    with some where function.......
    Thanks
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Jan 2011
    Link to this post
    Hello Paolo,

    Actually there is no direct way to get the control on a page. Here are two options

    var pageManager = PageManager.GetManager();
    var page = pageManager.GetPageNodes().Where(p => p.Page.Title == "MyNewsPage").SingleOrDefault();
    if(page.Page.Controls.Count > 0)
    {
        foreach(ControlData ctrl inpage.Page.Controls)
        {
            if(ctrl.Caption == "NewsView")
            {
            
            }
        }
    }

    2. The second option is using Page.Controls collection and find the control recursively.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    28 Jan 2011
    Link to this post
    Hello Ivan,
    I'm on getting the control of a page..... now I still need your help on assign the control "datasource" with the news I got using FluentAPI

    Thanks!
    Paolo
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Jan 2011
    Link to this post
    Hello Paolo,

    Actually you can try the code snippets I send you which can be used to set some properties at runtime. The better option would be to loop through the Page.Controls collection where you can get the instance of controls added to the page

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    28 Jan 2011
    Link to this post
    I've understood this Ivan, but taking as good I've got my NewsItem control....... how do I tell him take the items I've got in mine IList<NewsItem> and bind them as datasource?

    Thanks
7 posts, 0 answered