Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I’m having an issue and I’ve been on a dozen forum posts and
still can’t get this to work. I am trying to programmatically add a new node.
Scenario: I have created a form that allows you to create a node using the front end of the site. You enter a name for the node and press submit. This then goes off and programmatically creates the new node and publishes it. The page refreshes and shows a list of all my published nodes... however my newly created node is not there.
I check the backend and the page is in black text and displayed as published... so I then check the umbraco.config but the xml hasn't updated and does not contain my new node's details.
It is only when I manually press 'save & publish' that the xml updates. Oh and NOW it's appears in the front end.
Document newFolder = Document.MakeNew(folderName,DocumentType.GetByAlias("NodeTypeAliasHere"), new User(0),clientAreaRoot);
newFolder.getProperty("memberAccess").Value = memberId.ToString();
I'm using umbraco 22.214.171.124
I have tried a few solutions now and welcome to any suggestions! Thanks in advance.
Have you tried:
Worth a shot!
Thanks for the suggestion. Unfortunately I've tried most things on that page inlcuding the generateXml option and still nada nothing zilch!!
I keep thinking I MUST be missing something/doing something wrong/permissions maybe?...
Anything showing up in the log table?
I've done a fair bit of programttic work on nodes recently and have found publishing to be very hap hazard. It seems like the Publish method always completes within the code and without throwing an error but that doesn't neccesarily mean it published fully. Like you said it usually creates the node and it becomes visible in the back end but won't always show on the site.
Is your code literally that simple? As if it's part of several parent/child node creations that all happen at the same time this can effect it.
Secondly, try running debug with breakpoints on your creation code and on your rendering code (probaly in a razor or xslt file). You may find you're not creating the node until after the razor file has rendered the page, hence it won't have existsed when the page reloads. Another easy way to check would be to load the page a second time, at which point the new node should display.
Hope that helps
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted