Hi, Basically I'm creating a custom section and tree and the simple create usercontrol won't really cut it for me (/umbraco/create/simple.ascx). I only want to have a field for the user to be able to upload a file rather than specify the nodeName. I haven't been able to find any examples/tutorials on how to implement a custom "create" usercontrol. Does anyone have experience with this or know where I might find information on this?
You have to take care that, you should be create your Usercontrol inside the folder called UserControl un Umbraco root.The reason being this folder is been mapped when you create a macro, and this macros is pushed inside a template. And when you care a page in content Section using that tempate, you see your usercontrol.
Follow these steps:
1. Create a User control in usercontrol folder in Umbraco root. Key in some text so that you can see in on page later.
2. Go to Developer section and create a new macro name it as same as your ascx file. select the user control from the drop down that says ".NET User Control"
3. Go to the Setting section. You should have already create a Template and a document type related to it, else create one.
4. Under Templates open the template and insert the your newly create macro using 4ht icon in tool bar above.
5. Finally go to content section create a page using the document type and after you publish you should be able to see your text in Umbraco page.
Feel free to write back if you have further questions.
If the standard create-action will work for you, you can simply add the "ActionNew.Instance" in your custom tree and add a reference to your custom create-usercontrol (by root alias - as I remember) in the UI.xml located in wwwroot\umbraco\config\create This xml snippet is taken from the UI.xml and is a reference to a usercontrol used to create content items
Another option would be to create a custom action, which points to a custom webform that you use to create new items. I don't have a link to a post or blog, but you can check out the source code for my Google Analytics package on codeplex (http://gaumbraco.codeplex.com) as I use custom actions.
@slace Why wouldn't you put anything in the /umbraco folder? I know that some people rename the folder, but that shouldn't really be a problem if you get the path with the name of the umbraco folder from web.config. Or is there something that i'm missing?
I use the plugins-folder (wwwroot/umbraco/plugins) for my packages, as it is the most obvious place to put them in - in my oppinion. I believe Darren also uses the plugins-folder for his packages..
The reason I don't like the idea of putting stuff into the /umbraco folder is that (to an extent) it should be a black box. I've seen Umbraco installs get corrupted, and one common solution is to just 'reinstall' Umbraco. The problem is that if you've put a lot of custom stuff into there you need to make sure you have your custom components all backed up before hand.
Also, with 4.1 there's been quite a bit of stuff removed, so if people have expectations on certain folders they may be gone.
But I do know that there's been no clear direction from us on what's the best practice for packages installing though... maybe we've solve that in v5 :P
Thanks Morten, this is what I'm looking for (a way to create custom actions). I'll look through your source and see if I can find anything in there that helps.
Best method for creating "create" usercontrols.
Hi,
Basically I'm creating a custom section and tree and the simple create usercontrol won't really cut it for me (/umbraco/create/simple.ascx). I only want to have a field for the user to be able to upload a file rather than specify the nodeName. I haven't been able to find any examples/tutorials on how to implement a custom "create" usercontrol. Does anyone have experience with this or know where I might find information on this?
Thanks,
Michael Lawrence
You can create your own user controls. http://en.wikibooks.org/wiki/Umbraco/Samples_and_Articles/Dot_Net_Controls/Using_Dot_NET_Controls_With_Umbraco
Or do a search in google for creating user control in umbraco.
Hi Michael,
You have to take care that, you should be create your Usercontrol inside the folder called UserControl un Umbraco root.The reason being this folder is been mapped when you create a macro, and this macros is pushed inside a template. And when you care a page in content Section using that tempate, you see your usercontrol.
Follow these steps:
1. Create a User control in usercontrol folder in Umbraco root. Key in some text so that you can see in on page later.
2. Go to Developer section and create a new macro name it as same as your ascx file. select the user control from the drop down that says ".NET User Control"
3. Go to the Setting section. You should have already create a Template and a document type related to it, else create one.
4. Under Templates open the template and insert the your newly create macro using 4ht icon in tool bar above.
5. Finally go to content section create a page using the document type and after you publish you should be able to see your text in Umbraco page.
Feel free to write back if you have further questions.
Ranjit
I would not advise adding anything of your own within the /umbraco or /umbraco_client folders.
Hi Michael,
I can think of a couple of ways to archive what you are asking to do. But my initial response would be to check out the videos on umbraco.tv for creating custom sections in umbraco - this one shows how to setup create and delete actions:
http://umbraco.tv/documentation/videos/for-developers/custom-sections,trees-and-pages/setting-up-create-and-delete
If the standard create-action will work for you, you can simply add the "ActionNew.Instance" in your custom tree and add a reference to your custom create-usercontrol (by root alias - as I remember) in the UI.xml located in wwwroot\umbraco\config\create
This xml snippet is taken from the UI.xml and is a reference to a usercontrol used to create content items
Here is another posts about the above approach:
http://our.umbraco.org/forum/developers/extending-umbraco/7576-Custom-Section-with-multiple-trees-and-actions
Another option would be to create a custom action, which points to a custom webform that you use to create new items. I don't have a link to a post or blog, but you can check out the source code for my Google Analytics package on codeplex (http://gaumbraco.codeplex.com) as I use custom actions.
- Morten
@slace Why wouldn't you put anything in the /umbraco folder? I know that some people rename the folder, but that shouldn't really be a problem if you get the path with the name of the umbraco folder from web.config. Or is there something that i'm missing?
I use the plugins-folder (wwwroot/umbraco/plugins) for my packages, as it is the most obvious place to put them in - in my oppinion. I believe Darren also uses the plugins-folder for his packages..
- Morten
The reason I don't like the idea of putting stuff into the /umbraco folder is that (to an extent) it should be a black box. I've seen Umbraco installs get corrupted, and one common solution is to just 'reinstall' Umbraco. The problem is that if you've put a lot of custom stuff into there you need to make sure you have your custom components all backed up before hand.
Also, with 4.1 there's been quite a bit of stuff removed, so if people have expectations on certain folders they may be gone.
But I do know that there's been no clear direction from us on what's the best practice for packages installing though... maybe we've solve that in v5 :P
Thanks Morten, this is what I'm looking for (a way to create custom actions). I'll look through your source and see if I can find anything in there that helps.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.