10

@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 like this. @Html.Sitecore().Field("Property Name", Item) In your case, you would need to pass in the datasource item. Your model would look like this, notice ...


8

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 rendering. A cool feature Sitecore will take template inheritance into account when allowing you to select data sources, which means that you'll be able to ...


6

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 pass this data in the AJAX request, example code below, then you can fetch the needed site by the name. public ActionResult Index() { return View(new ...


5

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 (YourNamespace.ControllerClassName) and Controller Action (default is index if blank), Then when you create your controller rendering item you enter the Controller item ...


4

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 supported for Controller Renderings. Async only really works when it top to bottom across the stack and there are a number of challenges with various Sitecore ...


4

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 / in, it should just be Index It looks like you have not registered your controller with the IoC container. Sitecore 8.2 introduced a lot of new Dependency ...


4

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 is one can access what is passed via this parameter using RenderingContext.Current.Rendering.Properties[...] So in your example: @Html.Sitecore()....


4

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 appending the query string and process as required when receiving it Use a URL decode method such as HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request....


3

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. Specifically, you said that you created the buttons at /sitecore/content/Applications/WebEdit/Edit Frame Buttons/RelatedEvents/, yet, your parameter reads Related ...


3

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.RegisterMvcControllers(Assembly.GetExecutingAssembly()); With that you are only registering MVC Controllers that live in the website project. Its hard to tell ...


3

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 special characters and can solve your issue. Another way is that remove the bracket mannually and at the time of retrieving, do string manipulation but thats not ...


2

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.Kernel" where we have a BaseControler class. namespace YourSolutionName.Foundation.Kernel.Controllers { public class ControllerBase : SitecoreController { ...


2

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-40A7-4C8F-8F98-375DD1CD9544}. Once you have the Id in a proper state, you can then search the corresponding Sitecore Item using the Sitecore APIs. UPDATE If you ...


2

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 several layers of caching. This is obviously useful when you want to harness the power of data sources and don't want the browser to cache pages with ...


1

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.Get().Push(Html.ViewContext)) { @Html.Sitecore().Rendering() } It will make sure that ViewContext is pushed to the ContextService.


1

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) { RouteTable.Routes.MapRoute( "customapi/linkhover", "customapi/linkhover", new { controller = "...


1

You shouldn't need the / before the action name in your rendering. Change /Index to Index and it should work properly.


1

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 contexts


1

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 ActionResult object, not just a string of HTML. There are many types of ActionResult that would be hard to handle, or would have to be special-cased, such as ...


1

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 register it with the initialization pipeline. If you are on 8.2, you can use the DI built into Sitecore itself. See it here. If you still want to use Simple ...


1

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: Create a pipeline to register your route: public class RegisterMySampleRoute { public virtual void Process(PipelineArgs args) { RouteTable....


Only top voted, non community-wiki answers of a minimum length are eligible