Dynamically Create Page With Content Items
Hello,
I am new Sitefinity development. I have database bound RadTreeView Control that I added to my Sitefinity Toolbox. I am looking to accomplish the following
When an item on the tree is clicked, I would like the current page to refresh with new content. The new content on the page will come from a single content block item. So essentially I am looking to dynamically create a page by adding a content block item to the page. This dynamically created page should use the default template. How can I do this?
For the above to work, I need to create an association between a tree item and content block item, how can I do this?
Also, is there a way to insert hyper-links to other content block items (NOT pages), in a content block item. So when a link on content block item is clicked, the page reloads with the new content, and using the default page template?
A code sample would really help on the above, if thats possible.
Waiting anxiously for assistance on the above, thanks
Hi Steve,
1. Here is a sample that shows how to add control on a page
var pagemanager = PageManager.GetManager();
var cntrl = pagemanager.CreateControl<PageControl>();
cntrl.ObjectType =
typeof
(ContentBlock).FullName;
cntrl.PlaceHolder =
"Header"
;
cntrl.Caption =
"test"
;
cntrl.Description =
"dasdasda"
;
var page = pagemanager.GetPageNodes().First();
page.Page.Controls.Add(cntrl);
pagemanager.SaveChanges()