I'm new to umbraco and need some help with creating a custom section. I have created a section called notifications which will allow users to create messages for displaying in the front end, depending on which member is logged in the notifications will vary. I have modified the code found here: http://www.nibble.be/?p=71 to fit my needs, and created an aspx page with the notifications form. I need to be able to create an unlimited amount of nodes in the notifications tree and store each one in the database. When i right click on the root node i see the option to create a new node, but this throws an error as i have not coded the create functionality. I would like to know how i can allow this create button to create a new node with a new node id, and save it to the database. Any help or examples would be greatly appreciated.
Please let me know if any additional information is required.
I have added a csv export in custom section. Here is code for rendering the nodes. 'custom/contentExport.aspx' is my aspx page which export contents as csv.
Unfortunatley i dont have any example for creating nodes. To create nodes in tree , you have to create nodes and save in database. On rendering you have to retrieve list of nodes and add links by adding nodeid. NodeType is available in qureystring parameters (custom in this case)
I've added some code to the save function in order to add a new row using the next id in the sequence. I'm getting the following error when I right click on the parent node and click create:
Server Error in '/' Application.
ERROR CREATING CONTROL FOR NODETYPE: initNotifications
Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.
Exception Details: System.ArgumentException: ERROR CREATING CONTROL FOR NODETYPE: initNotifications
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Thanks for your reply, unfortunately that example creates only two nodes in the tree. The example does not cover the functionality of the create button. I am able to hard code more than one node into the tree, but I need to be able to right click on the parent node and create an unlimited amount of nodes from the back office.
I managed to create my own dialog box using the same create button by checking the nodeType in the umbracoDefault.js file. In the function createNew(), I simply added an if statement checking the nodeType. If the node type is set to "Notifications" then i redirect to my new custom aspx page using the function openModal().
Custom Umbraco Section - Create Function
Hello,
I'm new to umbraco and need some help with creating a custom section. I have created a section called notifications which will allow users to create messages for displaying in the front end, depending on which member is logged in the notifications will vary. I have modified the code found here: http://www.nibble.be/?p=71 to fit my needs, and created an aspx page with the notifications form. I need to be able to create an unlimited amount of nodes in the notifications tree and store each one in the database. When i right click on the root node i see the option to create a new node, but this throws an error as i have not coded the create functionality. I would like to know how i can allow this create button to create a new node with a new node id, and save it to the database. Any help or examples would be greatly appreciated.
Please let me know if any additional information is required.
To create new nodes, you can add code to "Save()" function of class CustomTasks
To render nodes in nodes tree, add your code to "Render()" function of class LoadCustomTree
Hi,
Thanks for the quick reply.
Here is what i have for those two functions:
public bool Save()
{
m_returnUrl = string.Format("notifications/editNotifs.aspx?id={0}", "1");
return true;
}
public override void Render(ref XmlTree tree)
{
XmlTreeNode xNode = XmlTreeNode.Create(this);
xNode.NodeID = "-2000";
xNode.Text = "Notification";
xNode.Action = "javascript:openNotif('" + "-2000" + "');";
xNode.Icon = "doc.gif";
tree.Add(xNode);
}
Do you have an example of what needs to go where in order to be able to create new nodes?
Thanks.
I have added a csv export in custom section. Here is code for rendering the nodes. 'custom/contentExport.aspx' is my aspx page which export contents as csv.
Unfortunatley i dont have any example for creating nodes. To create nodes in tree , you have to create nodes and save in database. On rendering you have to retrieve list of nodes and add links by adding nodeid. NodeType is available in qureystring parameters (custom in this case)
Thanks for your help.
I've added some code to the save function in order to add a new row using the next id in the sequence. I'm getting the following error when I right click on the parent node and click create:
Server Error in '/' Application.
ERROR CREATING CONTROL FOR NODETYPE: initNotifications
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.ArgumentException: ERROR CREATING CONTROL FOR NODETYPE: initNotifications
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
It seems I need to define the nodetype somewhere in order to be able to create new nodes. Any ideas on where to add the code?
You may alsio like to see this? http://www.geckonewmedia.com/blog/2009/8/3/how-to-create-a-custom-section-in-umbraco-4
Thanks for your reply, unfortunately that example creates only two nodes in the tree. The example does not cover the functionality of the create button. I am able to hard code more than one node into the tree, but I need to be able to right click on the parent node and create an unlimited amount of nodes from the back office.
You can remove original create action from tree contextmenu and replace it with your own. But I'm also interested if there is another way.
I managed to create my own dialog box using the same create button by checking the nodeType in the umbracoDefault.js file. In the function createNew(), I simply added an if statement checking the nodeType. If the node type is set to "Notifications" then i redirect to my new custom aspx page using the function openModal().
is working on a reply...