In a recent question that popped up on Stackoverflow, the user was trying to add some content via the Page Editor, but if the datasource was not set they were using code to create a child item under the current item and set that to the datasource. I suggested setting the
Datasource Location and
Datasource Template fields on the Rendering and just let the user handle the action via the “Select the Associated Content” dialog.
Unfortunately I couldn’t find a good blog post which covered the information I was trying to portray, or my Google skills were lacking a bit. For those seasoned Sitecore developers, this should be pretty second nature, but hopefully useful info for those new to Sitecore and finding their way around.
The following is out-of-the-box functionality, and provides a very user friendly way to add a component to a page and then associate existing or create a new item of a predefined template.