标签: sitecore-mvc

Sitecore与MVC的"动态占位符"

我正在寻找一个在MVC中运行的动态占位符解决方案.对于WebForms,至少有两个关于此"模式"的描述:

我还发现这个博客解释了如何使用MVC:

首先,我尝试使用MVC blogpost(SitecoreHelper的扩展)中的技术实现Techphoria的方法(使用GUID),并且我还尝试实现最后描述的方法(使用增量为Column_1,Column_2等的数字后缀).

通过我尝试的所有变化,我没有成功创建一个可行的解决方案.我的占位符没有正确命名(我最终得到了奇怪的占位符结构,或占位符重复自己).

如果不了解我的尝试细节,我想知道是否有其他人准备好了我可以使用的工作解决方案.

如果我找不到已经有效的解决方案,我会更详细地描述我的问题,看看我是否可以使用它.

asp.net asp.net-mvc sitecore sitecore6 sitecore-mvc

24
推荐指数
1
解决办法
1万
查看次数

Sitecore 8,MVC,体验编辑器:如何在使用字段编辑器按钮后进行渲染刷新

我们有一个渲染列出当前项目中TreeSelect中的选定项目.我们称之为"标签"(1)

我们在组件中添加了一个Field Editor按钮,让编辑器更改所选项.(2)(如例如添加自定义组件所述)

当编辑器单击(2)编辑器窗口(3)时,它将在对话框中打开.编辑器可以使用TreeSelect选择不同的项目(在我们的例子中称为标签).

当编辑器按下ok按钮(4)时,将设置值.

现在来问题:

当编辑器按下保存按钮时,这些值实际上是在它们被存储时设置的,但我们希望页面(1)上的列表在编辑器按下确定按钮(4)时立即反映设置项目,即在实际需要之前保存整个项目.

我们如何实现这一目标?

(我与Sitecore支持联系,但到目前为止我还没有得到任何答案...)

截图

更新 经过与支持人员的大量对话后,我们仍然没有有用的解决方案.

我们尝试将其转换为显示链接的字段渲染器.有用的是:

  • 在弹出的字段编辑器中编辑后,该字段会更新.(但...)
  • 第一次加载页面时看起来不错.
  • 您可以使用命令编辑WebEdit按钮来编辑字段并将其作为自定义按钮添加到字段中(注册<command name="webedit:fieldeditor" type="Sitecore.Shell.Applications.WebEdit.Commands.FieldEditor, Sitecore.Client"/>并设置单击按钮webedit:fieldeditor(command={3473DDA1-2983-493C-AF7A-054C75AA7AD3},fields=NameOfField指向guelf指向其自身的位置,并在其上设置"图标".)

什么不起作用是:

  • 该字段由原始值更新,而不是我想要显示的内容.涉及服务器代码,但不涉及html代码的呈现.
  • 当我想在字段编辑器中编辑值时,发送到字段编辑器的值不是原始值,而是实际显示在页面上的值.(我猜这可以用某种方式解决)

支持的问题变成了一个功能请求,让服务器参与渲染字段,而不仅仅是向JavaScript发送新值来更新它.服务器执行第一次渲染,因此当它已经参与更新时,应该允许它在以下时间进行渲染.

我们决定现在不花更多的时间在这上面(我们还有其他事情要做.)并且编辑经验不好,因为在编辑器实际保存项目之前,字段不会更新.

我们仍然没有适合这个问题的解决方案.如果你想继续努力并希望引用我的问题,那就是439059.

sitecore sitecore-mvc sitecore8

21
推荐指数
1
解决办法
1321
查看次数

'System.Web.Webpages.Html.Htmlhelper'不包含'Sitecore'的定义

当我使用时,我在Visual Studio中收到此错误@Html.Sitecore:

"System.Web.Webpages.Html.Htmlhelper"不包含"Sitecore的"和最佳推广方法重载"Sitecore.Mvc.HtmlHelperExtensions.Sitecore(System.Web.Mvc.HtmlHelper)"的定义有一些无效arguments.`

但是,一旦部署,它确实运行没有任何问题.

我正在使用Sitecore 7.2和MVC 5.1.

在此输入图像描述

我读过的文章涉及类似的错误消息,请谈谈文件夹文件的system.web.webPages.razor部分.这就是它在我的解决方案中的表现.Viewsweb.config

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
  <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
  </namespaces>
</pages>
Run Code Online (Sandbox Code Playgroud)

最初我以为我只需要重新启动VS,但这不起作用.有没有人有什么建议.

编辑 这是标准的Sitecore 7.2安装,因此具有以下绑定重定向:

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" xmlns="urn:schemas-microsoft-com:asm.v1"/>
    <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.1.0.0" xmlns="urn:schemas-microsoft-com:asm.v1"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" xmlns="urn:schemas-microsoft-com:asm.v1"/>
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" xmlns="urn:schemas-microsoft-com:asm.v1"/>
  </dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

另外,在查看visual studio的输出时,还有一个我之前没有发现的错误:

Instance argument: cannot convert from 'System.Web.WebPages.Html.HtmlHelper' to 'System.Web.Mvc.HtmlHelper'

编辑2

我不再认为这是Sitecore MVC问题.我得到了类似的错误@Html.ActionLink("xxx", "xxx").其他人在VS2012中看到了这个问题,但我使用的是2013年.

编辑3 …

asp.net-mvc sitecore sitecore-mvc sitecore7.2

15
推荐指数
4
解决办法
3万
查看次数

Sitecore MVC渲染类型澄清

有人可以帮我澄清何时使用以下内容(它们看起来与我相似并且令人困惑):

  1. 项目渲染
  2. 查看渲染
  3. 控制器渲染
  4. 方法渲染
  5. XSLT渲染
  6. 渲染参数
  7. 任何其他人

asp.net-mvc sitecore sitecore6 sitecore-mvc

10
推荐指数
1
解决办法
3343
查看次数

Sitecore 7.1 MVC渲染助手传递变量

我正在尝试将控制器返回的视图静态添加到我的视图中.在标准MVC中,我会做类似下面的事情.

@{Html.RenderAction("Product", "ProductListing", new {productId = product.ItemId});}
Run Code Online (Sandbox Code Playgroud)

这是我的控制器

[System.Web.Http.HttpGet]
public ActionResult Product(ID productId)
{
 var product= _productRepositorty.GetProduct(productId);

 return View("~/Views/Product/ProductDetails.cshtml", product);
}
Run Code Online (Sandbox Code Playgroud)

所以使用Sitecore渲染助手我有下面的内容,其中ID是Sitecore中的渲染项目,指向上面的控制器和操作.但是我无法将productId作为参数传递给Product操作(productId始终为null).这是将变量传递给另一个动作的正确方法吗?

@Html.Sitecore().Rendering("{AA6C2188-1897-4577-BE0A-25DD2BBA8AF1}", new { productId = product.ItemId })
Run Code Online (Sandbox Code Playgroud)

rendering sitecore razor sitecore-mvc sitecore7.1

10
推荐指数
1
解决办法
979
查看次数

Sitecore Tracker.Current未初始化

我有这个与Tracker有关的问题.

[InvalidOperationException: Tracker.Current is not initialized]
   Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking.Process(PipelineArgs args) +304
   (Object , Object[] ) +74
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
   Sitecore.Analytics.Pipelines.StartAnalytics.StartAnalyticsPipeline.Run() +293
   Sitecore.Mvc.Analytics.Pipelines.MvcEvents.RequestBegin.StartTracking.Process(RequestBeginArgs args) +139
   (Object , Object[] ) +74
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
   Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +184
   Sitecore.Mvc.Routing.RouteHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +74
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +923
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157
Run Code Online (Sandbox Code Playgroud)

在web.config我是

enableTracking = "真"

如果我设置为false它可以工作,但没有跟踪

sitecore sitecore-mvc sitecore8

9
推荐指数
1
解决办法
8445
查看次数

路径'/'的控制器未找到或未在Sitecore中实现IController

我正在从这里学习Sitecore中的Controller渲染.

我创建了一个简单的控制器(HelloWorld)和相关视图(Index.schtml).在Sitecore Explorer的渲染部分中映射它(使用Name PageContent)并在Sitecore Explorer的内容部分中的Home Item中添加渲染项目.但是当我浏览它时,它会给出错误.

The controller for path '/' was not found or does not implement IController. 
Run Code Online (Sandbox Code Playgroud)

我读过的所有帖子都与Asp .Net MVC有关..但我有与Sitecore MVC有关的问题

Sample.html(Sitecore Explorer渲染部分中的页面内容)

@using Sitecore.Mvc

<html>
<body>
    @Html.Sitecore().Placeholder("content")

    <p>Today's date is @DateTime.Now.ToShortDateString()</p>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

只有这条线给出了问题

@Html.Sitecore().Placeholder("content")
Run Code Online (Sandbox Code Playgroud)

如果我删除此行...它工作正常,浏览器上的页面显示日期和时间

的index.html

<p>Hello from Controller -todays Date is @DateTime.Now.ToString()</p>
Run Code Online (Sandbox Code Playgroud)

调节器

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MVC.Controllers
{
    public class HelloWorldController : Controller
    {
        //
        // GET: /HellowWorld/

        public ActionResult Index()
        {
            return View();
        } …
Run Code Online (Sandbox Code Playgroud)

.net c# controller sitecore sitecore-mvc

8
推荐指数
2
解决办法
3万
查看次数

Url.Action在某些环境中返回空字符串

我有一个Sitecore站点,在我的两个CD服务器上,Url.Action返回一个空字符串.这适用于本地和其他9个服务器,从开发到产品,CD和CM.

部署自动化确保将完全相同web.config的部署到所有环境中; 同样适用于所有其他配置.

我的控制器继承SitecoreController正确.这不会与某个控制器或操作隔离,所有控制器和操作都会发生这种情况.

什么会Url.Action在一个环境中返回一个空字符串而不是其他环境,使用相同的代码?

asp.net-mvc asp.net-mvc-routing sitecore-mvc sitecore8

8
推荐指数
1
解决办法
1425
查看次数

升级到Sitecore 8后,在Content Editor上出现错误

我已经从Sitecore 7.5升级到Sitecore 8,并且在尝试访问内容编辑器时出现错误.

'/'应用程序中的服务器错误.

值不能为空.

参数名称:fieldNameTranslator

描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.异常详细信息:System.ArgumentNullException:Value不能为null.参数名称:fieldNameTranslator

源错误: 在执行当前Web请求期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息.

[ArgumentNullException:Value不能为null.参数名称:fieldNameTranslator] Sitecore.ContentSearch.Linq.Solr.SolrIndexParameters..ctor(IIndexValueFormatter> valueFormatter,IFieldQueryTranslatorMap`1 fieldQueryTranslators,> FieldNameTranslator fieldNameTranslator,IExecutionContext [] executionContexts,> IFieldMapReaders fieldMap,Boolean convertQueryDatesToUtc)+310

Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1..ctor(SolrSearchContext> context,IExecutionContext [] executionContexts)+192 Sitecore.ContentSearch.SolrProvider.SolrSearchContext.GetQueryable(IExecutionCo> ntext [] executionContexts)+83 Sitecore.ContentTesting.ContentSearch.TestingSearch .GetRunningTests()+ 637 Sitecore.ContentTesting.Data.SitecoreContentTestStore.GetActiveTests(DataUri> hostItemDataUri,String searchText)+252 Sitecore.ContentTesting.Pipelines.GetContentEditorWarnings.GetContentTestingWar> nings.Process(GetContentEditorWarningsArgs args)+247(Object,Object [] )+141 Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)+365 Sitecore.Shell.Applications.ContentManager.Editor.GetWarnings(Boolean> hasSections)+271 Sitecore.Shell.Applications.ContentManager.Editor.Render(RenderContentEditorArg> s args,Control parent)+178 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.RenderEditor(Item> item,Item root,Control parent,Boolean showEditor)+231 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.UpdateEditor (Item> folder,Item root,Boolean showEditor)+374 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.Update()+411 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.OnPreRendered(Even> tArgs e)+212Boolean showEditor)+374 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.Update()+411 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.OnPreRendered(Even> tArgs e)+212Boolean showEditor)+374 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.Update()+411 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.OnPreRendered(Even> tArgs e)+212

sitecore sitecore-mvc sitecore8

7
推荐指数
1
解决办法
3945
查看次数

无法实例化事件处理程序.键入:Sitecore.Publishing.HtmlCacheClearer

它突然间停止了工作.我不知道出了什么问题,是什么导致了这种情况:

无法实例化事件处理程序.键入:Sitecore.Publishing.HtmlCacheClearer.方法:ClearCaches(方法:Sitecore.Events.Event + EventSubscribers.Add(String eventName,XmlNode configNode)).

我尝试了所有可以使它工作的东西,但事实并非如此

  1. 从Sitecore 7.2重新复制我的Sitecore文件
  2. 重新索引我的索尔
  3. 创建了一个全新的Sitecore项目
  4. 重新发布完整的网站
  5. 把我的头撞在桌子上

任何人都可以告诉我这个的原因以及可能的解决方案.我是Sitecore的新手.

更新publish:endpublish:end:remote

 <event name="publish:end">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCaches">
      <sites hint="list">
        <site>website</site>
      </sites>
    </handler>
  </event>
  <event name="publish:end:remote">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCaches">
      <sites hint="list">
        <site>website</site>
      </sites>
    </handler>
  </event>
Run Code Online (Sandbox Code Playgroud)

c# solr sitecore sitecore-mvc sitecore7.2

7
推荐指数
1
解决办法
1076
查看次数