We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [controller]

For questions specifically related to the use of MVC controllers with Sitecore. This tag should not be used for general .NET MVC controller questions.

Filter by
Sorted by
Tagged with
3
votes
1answer
61 views

Context.Site.Name changes to wrong site when using AJAX call

I'm using Sitecore 9.1.1, and a multisite setup. I have a custom controller rendering that I view from a page in Site2, my controller had 2 methods: an Index() method that returns the view, and a ...
0
votes
0answers
20 views

Template id not getting set using glassmapper _sitecoreContext.GetCurrentItem

I have an item item1 in sitecore with redering rendering1 in its presentation details. The rendering rendering1 has its datasource and is a controller rendering. The datasource of the rendering one ...
4
votes
2answers
183 views

How to pass rendering parameters for a static controller rendering

There is need to load a controller rendering from the Razor view. I'm doing it this way: @Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new { RedisCacheKeyPrefix = "scans_", ...
0
votes
0answers
74 views

Returning a file stream from a Controller

I have pdf files in folder, I want user enable to download file, in MVC controller its quite simple as below return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, filename); but ...
1
vote
1answer
99 views

OutputCache with a Sitecore controller

Using Sitecore 9.0.2, I've got code in two areas: SitecoreComponent (for controller renderings) and API (for JS calls). I've got a controller that inherits from SitecoreController in the API folder ...
0
votes
1answer
143 views

Any Best way to call the MVC action method from Hyperlink

Currently, we are having a hyperlink tag and the MVC action method is called directly from hyperlink as <a href="/api/sitecore/{controller Name}/{action Name}"> Hyperlink Text While hovering ...
1
vote
1answer
89 views

How to check access right in SitecoreController for Sitecore 9.1

In my JSON controller I want to check the access right from the User. My code looks like this public class MyController : SitecoreController { public static bool CheckAccessRight() { ...
1
vote
3answers
227 views

Sitecore 8.1 Controller Rendering Error

I am a newby and working on the Solutions Developer Course for Sitecore 8.2 online in Visual Studio with Sitecorerocks. Also just a heads up, very recently I had to rebuild this Visual Studio 2015 ...
1
vote
0answers
60 views

Getting SitecoreControllers Working With Swagger

Is there a good way to get Swagger to work with controllers that inherit SitecoreController? I've checked this blog out which uses controllers that inherit from ApiController. I thought I could get ...
0
votes
1answer
637 views

Sitecore support for async controller renderings

I am planning to use ASP.NET async pattern in my Sitecore project, but I'm getting the error: Asynchronous method which returns task as result cannot be executed synchronously Is there a way to ...
0
votes
1answer
535 views

FieldRenderer.Render for controller Rendering not “working”

I am trying to create a controller Rendering with the use of FieldRenderer.Render, but this does not work. The Controller public ActionResult PageImage() { return View(PageImageModelBuilder....
8
votes
1answer
301 views

How to Connect controller rendering with Interface Template

I am trying to create a simple Image controller Rendering and I don't want to add the template interface to my page type, because I want to add the image dynamicaly to my site. So here my "problems" ...
1
vote
1answer
34 views

Base Controller in Habitat

We are using habitat in our project. In most of our controller class of each feature, we are doing a same service call. So we are planning to have a Base Controller to avoid duplicates. Since we ...
5
votes
1answer
209 views

Sitecore 9 Platform Essentials Module 7 - Error Rendering Controller: Related Events when using an Edit Frame

I am working through the training for Sitecore 9 Platform Essentials. I am on Module 7 where they have you work on the Related Events controller and show you how to make a complex field editable in ...
3
votes
0answers
34 views

How to make two controller renderings working on same page to preserve tracking?

I have AccountsController in my solution with two methods ExportData and DeleteAccount. I have created two separate Controller Renderings with similar code: @using System.Web.Mvc @using System.Web....
0
votes
3answers
738 views

Passing an Item ID to the Controller via the Querystring

I am having an issue when passing itemid as query string to controller url is rendered like this http://sitecorelocal/api/sitecore/Product?sc_itemid=%7BB416980B-40A7-4C8F-8F98-375DD1CD9544%7 ...
4
votes
1answer
2k views

@Html.Sitecore.Field is not rendering any values

In this code model, fields are returning value but when I try to render using @Html.Sitecore().Field its returning null.For experience editor, these fields should be editable.How to do it? Am new to ...
2
votes
1answer
298 views

What is purpose of the Controllers folder in Layouts?

I've noticed that in /sitecore/layout there is a Controllers folder (first item underneath actually). In that folder you can add items of type Controller. These items have fields for a controller name ...
1
vote
0answers
74 views

Keep Sitecore Context Based On Page When Posting Back

I have a module that uses ajax to post back to the server for data. Some of this data is configurable while in experience editor. Users are winding up in a state with this module where experience ...
1
vote
0answers
584 views

Why am I receiving the error :Could not find the rendering in the HTML loaded from server [closed]

Here is my controller: namespace Website.Controllers { public class FormsController : Controller { // GET: Forms public ActionResult Index() { return View()...
0
votes
1answer
869 views

Sitecore invoking Index() method from the Controller errantly [closed]

I have a component whose assigned controller does not have an Index method. This is intentional, as the controller action is set to a specific action method. Regardless, Sitecore still attempts to ...
0
votes
2answers
426 views

I need to integrate a controller from a compiled dll into a controller I can build/control. How can I call that as a rendering?

I'm able to call this compiled dll's controller directly in a Sitecore rendering - e.g. I can create a rendering where I reference the controller, controller action, and area and the content from the ...
6
votes
2answers
520 views

IOC (Simple Injector) with EntityService

UPDATED WITH LATEST RESULTS AND QUESTION I've converted everything to pipeline and integrated Simple Injector. As I mentioned, I've never used SI before, and I'm having trouble with the controller ...
1
vote
1answer
96 views

Custom controller being overwritten by IoC

I have a simple Sitecore controller that returns an list of items from Sitecore. It's used it in a custom SPEAK UI page. This works fine in my local dev environment but when I deploy it into an ...