10
votes
Accepted
@Html.Sitecore.Field is not rendering any values
@Html.Sitecore().Field("Property Name") only works when your model is Sitecore.Mvc.Presentation.RenderingModel. You are using a custom model.
To use it in your case, you will need to pass in the item ...
8
votes
Accepted
How to Connect controller rendering with Interface Template
The fix
You need to specify a template in the Datasource Template field of your controller rendering. This is the field that tells Sitecore to prompt an editor to select a data source when adding a ...
6
votes
Accepted
Context.Site.Name changes to wrong site when using AJAX call
Sitecore does not resolve the Sitecore.Context properly in case of the HttpPost through AJAX requests. I would suggest to add the siteName as a parameter to your Action as part of the ExampleModel and ...
6
votes
Accepted
How to pass rendering parameters for a static controller rendering
The naming of the 3rd parameter of @Html.Sitecore().ControllerRendering method is a bit unfortunate. It's called parameters, while in my opinion it should be called properties.
The reason for that ...
6
votes
Sitecore support for async controller renderings
Async controller rendering is not supported .
Starting with Sitecore 8.2 async Mvc controllers is supported.
As of 8.2 we support async MVC controllers (directly routed). But async is still not ...
5
votes
Accepted
What is purpose of the Controllers folder in Layouts?
I think it's just another way of creating Controller rendering, You basically create Controller item (Of template /sitecore/templates/System/Layout/Controller) and enter the Controller Name (...
4
votes
Sitecore 8.1 Controller Rendering Error
There are a couple of potential issues here:
Set the controller name to the fully qualified class name, e.g MyProject.Controllers.SomeController, MyProject
Make sure the action name does not have the ...
4
votes
Passing an Item ID to the Controller via the Querystring
Your issue is that "{" and "}" are not valid characters in a URL. As such they have automatically been URL encoded when used in your query string.
Your options are
Strip the brackets before ...
3
votes
Accepted
Sitecore 9 Platform Essentials Module 7 - Error Rendering Controller: Related Events when using an Edit Frame
Thanks for the very detailed question!
Based on your description for how you created the Edit Frame Buttons and how you are referencing them, I suspect that the path the buttons is incorrect. ...
3
votes
IOC (Simple Injector) with EntityService
While @dnstommy is correct, what you are doing is not best practice and you really should refactor if you can to use a pipeline approach. The answer to your question is in this line:
container....
3
votes
Passing an Item ID to the Controller via the Querystring
Encoding of special characters in the URL is default behavior. To have item id without special characters, you can use Sitecore.Data.ID.ToShortID() method to have short id which will not have any ...
2
votes
Accepted
Base Controller in Habitat
The right place from my point of view to implement BaseController is in Foundation Layer.
In this way all features project can inherit from it.
In our solution we have a project "*.Foundation....
2
votes
Passing an Item ID to the Controller via the Querystring
You will need to replace the encoded value. From the Id %7BB416980B-40A7-4C8F-8F98-375DD1CD9544%7D you are passing, you will replace
%7B with {
%7D with }
Then you will have the Id as {B416980B-...
2
votes
Accepted
OutputCache with a Sitecore controller
This is most likely down to the DisableBrowserCaching setting in Sitecore.
When set to true this setting issues no-cache headers which leaves Sitecore to optionally handle the caching of the page via ...
2
votes
Any Best way to call the MVC action method from Hyperlink
You can create your own custom route pipeline in sitecore and map to route the url link like below
public class YourCustomRouteName
{
public virtual void Process(PipelineArgs args)
{
...
2
votes
Accepted
FieldRenderer.Render for controller Rendering not "working"
It seems that I was using the wrong Context Item when I use this
RenderingContext.Current.Rendering.Item
everything is working fine. Would be nice to know what is the difference between these two ...
2
votes
Debugging in VS
If you are connecting to a remote instance.
Ensure the msvsmon.exe the remote debugging service is running.
Ensure the ports are accessible through firewall.
Ensure your user has access to remote ...
1
vote
Accepted
Html.Sitecore().Rendering() causes: Attempt to retrieve context object of type 'System.Web.Mvc.ViewContext' from empty stack
From the exception it looks like it's ViewContext missing.
I'm not sure why it happens in your scenario but to fix this you can try the following code:
@using (Sitecore.Mvc.Common.ContextService....
1
vote
ServiceAPIController No HTTP resource was found that matches the request URI
You need to register your route first like below:
public class RegisterHttpRoutes
{
public void Process(PipelineArgs args)
{
GlobalConfiguration.Configure(Configure);
}
protected void ...
1
vote
Lost All Layout After MVC Form Postback to Controller Rendering
Looking at the post you have linked too, I believe it describes the behaviour in which you are experiencing.
This will not work if you are using Sitecore’s form handler (@Html.FormHandler("...
1
vote
Accepted
Lost All Layout After MVC Form Postback to Controller Rendering
Search can be implemented with ajax call without causing redirection to the another page. here you can find the example code -
<script>
// Function to make the AJAX call and handle response
...
1
vote
Lost All Layout After MVC Form Postback to Controller Rendering
I have implemented this functionality before. To achieve this functionality I have used Vue.js. You can choose whatever Javascript framework you want to use. The benefit of using Vue.js or any other ...
1
vote
Accepted
Where to find the Controller Folder(Source File)
If you want to create a controller rendering then there is an option to clone an existing component in Sitecore SXA. Follow this article to know how to clone a component in SXA.
https://sbhatiablogs....
1
vote
Loading of new page blocked by api call
It looks like a problem with session state behavior. I have faced similar issue in Sitecore 8, when API calls from frontend came to queue and block one another. It was fixed by adding [...
1
vote
Sitecore 8.1 Controller Rendering Error
You shouldn't need the / before the action name in your rendering. Change /Index to Index and it should work properly.
1
vote
Sitecore support for async controller renderings
You can not use async pattern in Sitecore as it does not support it. If you will try to make it work, you will get exceptions or it will work synchronously. There is a very good article from kamsar on ...
1
vote
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?
If I'm understanding correctly, you're looking to get the result from a controller, and return that through an API controller. The problem with that is that a controller action generally returns an ...
1
vote
IOC (Simple Injector) with EntityService
It's not Sitecore best practice to modify the global.ascx file. In 8.2 global.ascx has been moved private so you no longer allowed to modify the global.ascx anymore. You should build it all and ...
1
vote
Custom controller being overwritten by IoC
For anyone coming across this here is what I did.
If you have a DI configured it resets any routes registered after you've added them so you need to register them in the initialize Pipeline like so:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
controller × 33mvc × 9
presentation × 3
dependency-injection × 3
mvc-forms × 3
sxa × 2
sitecore-api × 2
training-certification × 2
xconnect × 1
experience-editor × 1
exm × 1
security × 1
pipelines × 1
caching × 1
helix × 1
multisite × 1
habitat × 1
webapi × 1
redirect × 1
routing × 1
renderfield × 1
pdf × 1
integration × 1
api × 1
processor × 1