Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
Treeview in C# - trying to get children from sitecore to the webapp
Bobby Underwood
Oct 4 2011 12:03 AM
4.1k
Reply
try
{
masterDb = Factory.GetDatabase("master");
Sitecore.Data.Database masterdb = Sitecore.Configuration.Factory.GetDatabase("master");
Sitecore.Data.Items.Item srpackshome = masterdb.GetItem("/sitecore/content/home/Sports Recreation/Packs");
Sitecore.Collections.ChildList children = srpackshome.Children;
foreach (Sitecore.Data.Items.Item child in srpackshome.GetChildren())
{
TreeNode srPacksItem = new TreeNode(child.Name.Substring(child.Name.LastIndexOf(Path.DirectorySeparatorChar)+1));
//TreeNode srPacksItem = new TreeNode(srpackshome.Name.Substring(srpackshome.Name.LastIndexOf(Path.DirectorySeparatorChar)+1));
treeSR.Nodes.Add(srPacksItem);
}
---------------------------
using the above code I am trying to pull information from Sitecore and into the Web application to put the content into the treeview nodes.
The treeview consists of 4 levels. I am just trying to get the childrens children in from sitecore. The children will be static and I am referencing their folder in sitecore to pull their children into the application. It is not connecting.
Is there anyone familiar with sitecore that could help?
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Db Connection
C# Window application GUI Problem