无法在从服务器加载的HTML中找到呈现。 Sitecore体验编辑问题 [英] Could not find the rendering in the HTML loaded from server. Sitecore experience editor issue

查看:91
本文介绍了无法在从服务器加载的HTML中找到呈现。 Sitecore体验编辑问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近从Sitecore 7.2迁移到9.0.2,从那时起,当我们尝试使用体验编辑器中的数据源添加控件(通过单击Add here)时,我们开始收到以下错误。这只发生在Sitecore的9.0.2实例上。我们不是MVC项目。只是简单的网络表单。单击页面上的第一个或第二个添加时会发生这种情况。我们没有在项目中引用Prototype.js,所以不确定将jQuery置于无冲突模式会有所帮助。此外,我们可以通过转到Sitecore中页面的演示详细信息来添加带数据源的控件。非常感谢任何帮助。



以下是我得到的错误的截图。



< a href =https://i.stack.imgur.com/LmhE5.png> https://i.stack.imgur.com/LmhE5.png [ ^ ]



错误JS



https://i.stack.imgur.com /uItNp.png [ ^ ]



我尝试了什么:



我们没有引用Prototype.js该项目因此不确定将jQuery置于无冲突模式会有所帮助。此外,我们可以通过在Sitecore中查看页面的演示文稿详细信息来添加带数据源的控件。

我还尝试创建一个新的控件(渲染),但它没有帮助。

添加/删除占位符的允许控件也无济于事。

We recently moved from Sitecore 7.2 to 9.0.2 and since then we have started getting following error when we try to add a control(by clicking "Add here") with datasource from the experience editor. This is only happening on the 9.0.2 instance of Sitecore. Ours is not a MVC project. Just simple web forms. This happens on clicking either the first or the second Add here on the page. We are not referencing Prototype.js in the project so not sure if putting jQuery into No-conflict mode will help. Also, we are able to add controls with datasource by going to presentation details of the page in Sitecore. Any help is greatly appreciated.

Below are the screenshots of the error I am getting.

https://i.stack.imgur.com/LmhE5.png[^]

And the error in JS

https://i.stack.imgur.com/uItNp.png[^]

What I have tried:

We are not referencing Prototype.js in the project so not sure if putting jQuery into No-conflict mode will help. Also, we are able to add controls with datasource by going to presentation details of the page in Sitecore.
I also tried to create a new control(rendering) but it did not help.
Adding/removing allowed controls of the placeholder also did not help.

推荐答案

感谢大家的意见和帮助。问题是在Sitecore 9中,当用户使用体验编辑器在页面上添加控件时,在最终添加按钮上单击(在提供数据源之后)被视为POST事件。在Sitecore 7.2中,它是一个GET请求。



我们在我们的后端(.cs文件)中编写了一些代码,它们正在查看它是否为POST类型请求,如果是,请重定向到其他页面。如下。



if(Request.HttpMethod ==POST)

{

//重定向到另一个页面

}



我在这里添加了一个检查,仅在用户未处于体验编辑器模式时运行此代码,如下所示。



if(Request.HttpMethod ==POST&&!Repository.IsUserEditting())

{

//重定向到另一个页面

}



这解决了这个问题。再次感谢。如果有人有任何问题,请告诉我。
Thanks everyone for your comments and help. The issue was that in Sitecore 9, when a user adds a control on a page using the Experience Editor, on the final add button click (after providing a datasource) is treated as a POST event. In Sitecore 7.2, it was a GET request.

We had some code written in our backend (.cs file) which was looking to see if it a POST type of request and if yes, redirect to a different page. Like below.

if (Request.HttpMethod == "POST")
{
//redirect to a different page
}

I added a check here to only run this code when user is NOT in Experience Editor mode like below.

if (Request.HttpMethod == "POST" && !Repository.IsUserEditting())
{
//redirect to a different page
}

This fixed the issue. Thanks again. Let me know if anyone has any questions.


这篇关于无法在从服务器加载的HTML中找到呈现。 Sitecore体验编辑问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆