Are you able to get your custom section to display? If not, you may need to give your user access to that section. Go to the user section, and click on your user account, then ensure you have given that account access to your new section.
Have you added breakpoints in your code to a) see if the code gets called at all, and b) to make sure _service.FindSections() is actually returning anything?
Hmm, the class itself looks fine, and the fact that nothing is loading at all would suggest it's a problem creating the tree. Have you had a look in the umbracoLog table to see if there is anything suspicious?
I reckon it was the fact the app pool restarted (ie, by setting it up in IIS, the app pool will have started a fresh anyway). I'd imagine the list of trees is stored internally, so if you defined your tree after the list was populated, it wouldn't get found (my best guess anyway).
It's important to understand how the treeHandlerAssembly and the treeHandlerType work together. When Umbraco looks for a tree, it looks for an assembly named "treeHandlerAssembly.dll" (where treeHandlerAssembly is what you entered into the treeHandlerAssembly column of umbracoAppTree), it then looks for a class inside that DLL named "treeHandlerAssembly.treeHandlerType" (note, it constructs the class name by combining the treeHandlerAssembly and treeHandlerType together), so you need to be carefull with your naming around these.
Beyond that, it does sound like it is caching somewhere. I'd recommend restarting your app pool after making changes, and maybe also clearing your ASP.NET Temporary Files folder.
I have now tracked down the issue, I have no idea why it is an issue though.
I had a Ninject Module defined in the utilix project as I was attempting to use dependency injection for the services, repositories etc.
If I comment this out the tree works however if I uncomment the tree fails, this is really weird as the module is not accessed from anywhere at the moment.
Custom tree not rendering.
Got a custom tree that refuses to render code for tree can be found below, this is very simple at the moment as I have stripped it back.
namespace Utilix
{
public class loadMaintenance : BaseTree
{
private IUtilixService _service;
public loadMaintenance(string application) : base(application)
{
_service = new UtilixService(new DefaultCacheProvider(), new UtilixRepository());
}
protected override void CreateRootNode(ref XmlTreeNode rootNode)
{
rootNode.Icon = FolderIcon;
rootNode.OpenIcon = FolderIconOpen;
rootNode.NodeType = "init "+ TreeAlias;
rootNode.NodeID = "init";
}
public override void Render(ref XmlTree tree)
{
var nodes = _service.FindSections();
foreach (var n in nodes)
{
var node = XmlTreeNode.Create(this);
node.NodeID = n.Id;
node.Text = n.Text;
node.Action = n.Action;
node.Icon = n.Icon;
tree.Add(node);
}
}
public override void RenderJS(ref System.Text.StringBuilder Javascript)
{
Javascript.Append(
@"
function openUtilix(id)
{
parent.right.document.location.href = 'plugins\utilix\dashboard.aspx?id='+id;
}
");
}
}
}
umbracoApp
9, utilix, utilix.gif, Utilix, NULL
umbracoAppTree
False,True,0,utilix,functions,Functions,legacy,legacy,Utilix,loadMaintenance, NULL
Have tried all sorts to get this working it appears as though the Class is never called.
Please Help
Hi Jonathan,
Are you able to get your custom section to display? If not, you may need to give your user access to that section. Go to the user section, and click on your user account, then ensure you have given that account access to your new section.
Cheers
Matt
Hi Matt
Section shows fine, also if I call one of the other trees for instance loadUsers from the umbraco assembly, they load fine.
Thanks
Jonathan
Hey Jonathan,
Have you added breakpoints in your code to a) see if the code gets called at all, and b) to make sure _service.FindSections() is actually returning anything?
Many thanks
Matt
Hi Matt,
I have added breakpoints seems to never get called, I have also tried to just add a hardcoded node to the Render method but get the
same result.
Thanks
Jonathan
And your Utilix.dll is in the bin folder? (Sorry for all the simple questions, but I need to eliminate them first)
Cheers
Matt
Matt
The Utilix.dll is in the bin folder.
Thanks for your help.
Jonathan
Hmm, the class itself looks fine, and the fact that nothing is loading at all would suggest it's a problem creating the tree. Have you had a look in the umbracoLog table to see if there is anything suspicious?
Cheers
Matt
Matt
The Utilix.dll is in the bin folder.
Thanks for your help.
Jonathan
Sorry for the double post, there is nothing in the umbracoLog table that relates to this.
Cheers
Jonathan
Have you tried restarting your app pool?
Cheers
Matt
Matt just out of interest could there be some sort of cache issue, I was using WebMatrix just because it
was quicker to setup.
After all the frustration I decided to make a copy of the site and have run it under IIS and low and behol
it started to work.
Thanks
Jonathan
I reckon it was the fact the app pool restarted (ie, by setting it up in IIS, the app pool will have started a fresh anyway). I'd imagine the list of trees is stored internally, so if you defined your tree after the list was populated, it wouldn't get found (my best guess anyway).
Glad you've got it working though.
Matt
Matt plott thickens had it working after moving to iis however changed the name of the tree in umbracoAppTree and the alias and now
it doesn't work.
I have then tried to change the name back and it still doesn't work.
Regards
Jonathan
It's important to understand how the treeHandlerAssembly and the treeHandlerType work together. When Umbraco looks for a tree, it looks for an assembly named "treeHandlerAssembly.dll" (where treeHandlerAssembly is what you entered into the treeHandlerAssembly column of umbracoAppTree), it then looks for a class inside that DLL named "treeHandlerAssembly.treeHandlerType" (note, it constructs the class name by combining the treeHandlerAssembly and treeHandlerType together), so you need to be carefull with your naming around these.
Beyond that, it does sound like it is caching somewhere. I'd recommend restarting your app pool after making changes, and maybe also clearing your ASP.NET Temporary Files folder.
Cheers
Matt
I have now tracked down the issue, I have no idea why it is an issue though.
I had a Ninject Module defined in the utilix project as I was attempting to use dependency injection
for the services, repositories etc.
If I comment this out the tree works however if I uncomment the tree fails, this is really weird as the module
is not accessed from anywhere at the moment.
Jonathan
Interesting, I'd have never have guessed that =)
Good luck with getting the rest working, but glad you've now got your tree displaying.
Matt
Thanks for the help hope I can return the favour one day.
Jonathan
is working on a reply...