Is there some way in Sitecore 7 when using MVC to create a controller which can return a PartialView result using the rendering defined on the item (or its template standard values), without having to set up Layout and Renderings for that item?
I can see how to do this using custom template fields, but this seems like a hacky way of doing things. Is there a better way to achieve the following:
public PartialViewResult MyAction(string someParameter)
{
Item selectedItem;
//some code here to retrieve sitecore item based on the value of someParameter
var cshtmlFilePath = selectedItem["MyCustomField"];
return PartialView(cshtmlFilePath, selectedItem);
}
FYI my cshtml could be something really simple like:
@model Sitecore.Data.Items.Item
<div>
<h3>
@Html.Sitecore().Field("Title", Model)
</h3>
<div>
@Html.Sitecore().Field("Content", Model)
</div>
</div>
While the approach above will work, I don't like it because there is not a proper interface for assigning the rendering to the item's template's standard values. I could easily define my own presentation template which has a single 'Path' field, then create items somewhere under `sitecore/layout/Renderings' then reference that item in a link field of my content item, but it just seems like that should be doable out of the box.