sitecore-mvc

Experience Editor is not showing the ribbon options in sitecore 8

倖福魔咒の 提交于 2019-12-12 06:39:52
问题 I have logged in to sitecore through administrator account. I have a page in my site if press 'experience editor' or preview button,editor ribbon is not displaying. I am new to sitecore, Is that a permission issue am facing? 回答1: If you see only header of the ribbon like that: Click on the arrow on the right. You should see all the options: If you don't see even the header, there must be some errors on the console. 回答2: This specifically applies to MVC implementations and could apply to

How to Unit Test a GlassController Action which Uses Sitecore.Context.Item

梦想与她 提交于 2019-12-12 04:09:01
问题 I'm a sitecore developer and I want to create a sample sitecore helix unit testing project for testing out the logic you see in our "ArticleController" controller's Index() action method: public class ArticleController : GlassController { public override ActionResult Index() { // If a redirect has been configured for this Article, then redirect to new location. if (Sitecore.Context.Item.Fields[SitecoreFieldIds.WTW_REDIRECT_TO] != null && !string.IsNullOrEmpty(Sitecore.Context.Item.Fields

Change sitecore item without redirect

早过忘川 提交于 2019-12-11 07:56:31
问题 I have a custom pipeline processor inserted after ItemResolver in which I overwrite the current context item with a new item selected by the content editor from a droplink. If I go to that dynamic item via a normal request through my website and through my processor and i change my context item, it will stil render the same item: public override void Process(HttpRequestArgs args) { // some code Context.Item = dropLink.TargetItem; } Strangely, if I issue a request via the item API, sitecore

Sitecore using Glass mapper and MVC

会有一股神秘感。 提交于 2019-12-11 04:28:24
问题 Hi am using the Glass mapper in combination with Sitecore MVC. I created model below. using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Test { using Glass.Mapper.Sc.Configuration.Attributes; [SitecoreType(AutoMap = true)] public class GlassTestModel { public virtual string Title { get; set; } } } this is my view @inherits Glass.Mapper.Sc.Web.Mvc.GlassView<Test.GlassTestModel> <div> <h2>Hello</h2> <h2>@Model.Title</h2> </div> I also tried this first

Sitecore glass editable cannot convert lambda expression

为君一笑 提交于 2019-12-11 04:08:42
问题 I'm using Sitecore 7.5, MVC 5.2 and Glass Mapper 3.2. When using Editable() in the renderings, the error below is shown in visual studio even though it renders properly when using the site and/or the page editor. Am I missing a reference or something? Error: "Cannot convert lambda expression to type 'System.Linq.Expressions.Expression>' because it is not a delegate type" View @using Sitecore.Mvc @using Sitecore.Mvc.Presentation @inherits Glass.Mapper.Sc.Web.Mvc.GlassView<Air.SitecoreModels

Sitecore Dictionary Items

浪尽此生 提交于 2019-12-11 01:49:44
问题 In the earlier versions of Sitecore there were an issue with dictionary items, if we have a CDs environment, sometimes the Dictionary.dat file may not get updated on CDs server. 1) is this issue still exist with Sitecore 8 ? 2) if yes, what is the best approach to implement custom dictionary items for my website ? 回答1: I have this issue on Sitecore 8.1 Initial Release. To fix it you need to add on publish:end and publish:end:remote event a new handler. This is the class : public class

Sitecore 8.1 output cache not clearing

我的梦境 提交于 2019-12-07 22:40:52
问题 we have CA and CD on different servers hosted in Azure Web Apps written using ASP.NET MVC. I've added below so that output cache gets cleared upon publish end. <event name="indexing:end:remote"> <handler type="Sitecore.ContentSearch.Maintenance.IndexDependentHtmlCacheManager, Sitecore.ContentSearch" method="Clear"/> </event> However, the output cache doesn't get cleared and website content doesn't get updated. Any configuration that I need to do on top of above? Thanks. 回答1: You probably are

Save Return Error in Sitecore Page Editor

☆樱花仙子☆ 提交于 2019-12-07 05:36:30
问题 I get an error when save a page in page editor.. Somehow when I edited the page from presentation > detail and display it in page editor it works fine.. The error logs is in below here.. ERROR After parsing a value an unexpected character was encountered: {. Path 'scLayout', line 38, position 85. Exception: Newtonsoft.Json.JsonReaderException Message: After parsing a value an unexpected character was encountered: {. Path 'scLayout', line 38, position 85. Source: Newtonsoft.Json at Newtonsoft

Sitecore MVC and FieldRenderer.Render for Links

a 夏天 提交于 2019-12-07 04:56:22
问题 I'm trying to render a general link field like this - FieldRenderer.Render(item, "link") . This works as expected but how do I set custom text within the a tag that gets rendered. I want my output to look something like this <a href="[link from sitecore]">[custom text from another field]</a> Basically, the text for the link should come from another field on the item. Thanks 回答1: You probably want to try the following: @Html.Sitecore().BeginField("Link Field") //custom code @Html.Sitecore()

How can I get Sitecore Field Renderer to use a css class for an image

[亡魂溺海] 提交于 2019-12-06 15:33:42
Using Sitecore (7) & MVC, I'd like to know how to add a css class attribute for an image to the field renderer in sitecore. Without Sitecore it looks like this: <div class="background-container"> <img src="/images/background-1.jpg" class="background"> </div> With Sitecore: <div class="background-container"> @Html.Sitecore().Field(Constants.Fields.HomeBackgroundImage) </div> There doesn't seem to be a way to add the class background to the image itself in Sitecore. Is there another way to do this? Thanks. Benutzer This was what I was looking for: @Html.Sitecore().Field("MyFieldName", myItem,