Created
April 23, 2016 12:34
-
-
Save herskinduk/9c4294fe57f2ee2bfd2c6115a6543191 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Sitecore.Mvc.Helpers; | |
using Sitecore.Mvc.Pipelines; | |
using Sitecore.Mvc.Pipelines.Response.RenderRendering; | |
using Sitecore.Mvc.Presentation; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Web; | |
namespace SUGCON16.Extensions | |
{ | |
public static class SitecoreHelperExtension | |
{ | |
public static HtmlString ControllerRendering(this SitecoreHelper helper, string controllerName, string actionName) | |
{ | |
var rendering = new Rendering() | |
{ | |
RenderingType = "Controller" | |
}; | |
rendering["Controller"] = controllerName; | |
rendering["Controller Action"] = actionName; | |
rendering["Cacheable"] = "1"; | |
// Cache_VaryBy... | |
// Datasource | |
var writer = new StringWriter(); | |
var args = new RenderRenderingArgs(rendering, writer); | |
PipelineService.Get().RunPipeline("mvc.renderRendering", args); | |
return new HtmlString(writer.ToString()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment