Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save takahirohonda/2c97e1ffb505a3d48929693729ffa009 to your computer and use it in GitHub Desktop.
Save takahirohonda/2c97e1ffb505a3d48929693729ffa009 to your computer and use it in GitHub Desktop.
using-rendering-parameters-to-inject-data-into-hidden-input-sitecore-3.cs
using SitecoreDev.Feature.Design.Repository;
using Sitecore.Mvc.Presentation;
using Sitecore.Mvc.Controllers;
using System.Web.Mvc;
namespace SitecoreDev.Feature.Design.Controllers
{
public class CustomDataDivController : SitecoreController
{
private readonly ICustomDataDivRepository customDataDivRrepository;
private readonly RenderingParameters parameters;
public CustomDataDivController() : this(new CustomDataDivRepository()) { }
public CustomDataDivController(ICustomDataDivRepository repository)
{
this.customDataDivRrepository = repository;
this.parameters = RenderingContext.Current?.Rendering?.Parameters;
}
public ActionResult CustomDataDiv()
{
var data = this.customDataDivRrepository
.GetParamsForCustomDiv(parameters);
return View(data);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment