Relationship between the controls and the pages
Hello Fernando,
You can use our Fluent Api to get the PageNode of the specific page and then select the control that you wish from that page. Here's a sample code that gets the html from a ContentBlock control on a page with Title "PageTitle" does this:
PageNode node = App.WorkWith().Pages().Where(p => p.Title == "PageTitle").Get().First();
var control = node.Page.Controls.Where(c => c.GetType().Name == "ContentBlock").First();
PageManager manager = PageManager.GetManager();
ContentBlock block = manager.LoadControl(control) as ContentBlock;
var html = (control as ContentBlock).Html;
Svetoslav, thanks for replying. one more question. could you give an example to get thegui of a photograph from an Image Control, I tried the same thing, but I have not worked.
thank you very much.
Hi F_E_R_S,
You can use this:
PageNode node = App.WorkWith().Pages().Where(p => p.Title ==
"Home"
).Get().First();
var control = node.Page.Controls.Where(c => c.ObjectType ==
"Telerik.Sitefinity.Web.UI.PublicControls.ImageControl"
).First();
PageManager manager = PageManager.GetManager();
ImageControl imageControl = manager.LoadControl(control)
as
ImageControl;
var imageId = imageControl.ImageId;