Can't see what's wrong from the code, looks pretty fine to me. Only difference i can see from some code I've been using for csmMailer, is the fact that I'm explicitely clearing the menu actions before adding the custom actions (me thinks I was experiencing the same issue...)
Can you check if the following does work in your case:
Unable to add custom actions to childnodes in custom tree
Hi,
I have added a custom section to Umbraco to enable the productmanagement.
For this I have created a custom tree with custom actions, all works fine so far.
The custom tree looks like this:
ProductManagement
I have added custom actions to the 'Collection', 'ProductModels' and 'ProductTypes' nodes using the following code"
XmlTreeNode oCollectionNode = addRootNode("Collecties", "docPic.gif");
oCollectionNode.Menu.AddRange(new List<IAction> { ActionCreateCollection.Instance });
Tree.Add(oCollectionNode);
XmlTreeNode oTypeNode = addRootNode("ProductTypes", "docPic.gif");
oTypeNode.Menu.AddRange(new List<IAction> { ActionCreateProductType.Instance });
Tree.Add(oTypeNode);
XmlTreeNode oModelNode = addRootNode("Modellen", "docPic.gif");
oModelNode.Menu.AddRange(new List<IAction> { ActionCreateModel.Instance });
Tree.Add(oModelNode);
This all works fine.
The childnode 'Fall Collection 2011' is an actual records from the database which i can edit by clicking on it.
The problem arises when i want to add a custom action to nodes on this level (childnodes under ProductModels also do not appear), see the code below:
using (SqlConnection oConn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DSN"].ConnectionString))
{
oConn.Open();
using (SqlCommand oCommand = new SqlCommand("spProductCollection_G", oConn))
{
oCommand.CommandType = CommandType.StoredProcedure;
SqlDataReader oReader = oCommand.ExecuteReader();
while (oReader.Read())
{
var nodeProductCollection = XmlTreeNode.Create(this);
nodeProductCollection.Text = oReader["ProductCollection"].ToString();
nodeProductCollection.Icon = "docPic.gif";
nodeProductCollection.Action = "javascript:editProductCollection(" + oReader["ID"].ToString() + ")";
nodeProductCollection.Menu.AddRange(new List<IAction> { ActionCreateProduct.Instance });
TreeService treeService = new TreeService(-1, TreeAlias, true, false, DialogMode, app, string.Format("Collection_{0}", oReader["ID"].ToString()));
nodeProductCollection.Source = treeService.GetServiceUrl();
Tree.Add(nodeProductCollection);
}
oReader.Close();
}
oConn.Close();
}
I can see the childnodes, the collections, appear but the actions do not appear. The same thing for productmodels and other items on the same level.
Can somebody tell me what im doing wrong?
Thanks in advance.
Can't see what's wrong from the code, looks pretty fine to me. Only difference i can see from some code I've been using for csmMailer, is the fact that I'm explicitely clearing the menu actions before adding the custom actions (me thinks I was experiencing the same issue...)
Can you check if the following does work in your case:
Cheers,
/Dirk
is working on a reply...