Find the content inside a PageNode
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();
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
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();
App.WorkWith().NewsItems().Get();
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"
)
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
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
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