FieldRenderer - 从不同模板部分获取特定字段名称
有没有办法从具有多个部分的模板中获取特定字段名称到 FieldRenderer 控件?
F. 前。我有一个包含“Data”和“Data2”部分的模板,两者都有一个名为“Text”的单文本字段。有没有办法让我的 FieldRenderer 获取“Data2”部分中的字段“Text”
如果以下建议之一有效,那就太好了:
<sc:FieldRenderer ID="test" runat="server" FieldName="Text" Section="Data2" />
<sc:FieldRenderer ID="test" runat="server" FieldName="Data2/Text" />
BR Larre
Is there a way to get a specific field name from a template with several sections to a FieldRenderer control?
F.ex. I have a template with the sections "Data" and "Data2", both have a single-text-field called "Text". Is there a way to make my FieldRenderer get the field "Text" in section "Data2"
It would be nice if one of the below suggestions worked:
<sc:FieldRenderer ID="test" runat="server" FieldName="Text" Section="Data2" />
<sc:FieldRenderer ID="test" runat="server" FieldName="Data2/Text" />
BR Larre
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然它是故意这样开发的(我们不希望 Sitecore 开发人员在部分名称上浪费时间),但我认为包含这样的东西确实有意义。
让我将其列为功能请求。
如果您想了解其工作原理,您应该首先了解 fieldRenderer 是如何工作的。它启动了一个名为“renderField”的管道。
在第二步中,它读取字段值:
将其替换为您自己的自定义类,如下所示:
行中的内容:
但现在带有错误检查:)
Though it's developed like this on purpose(we don't want Sitecore developers to waste time on section-names), I think it does make sense to include such a thing.
Let me list this as a feature request.
If you want to have this working right know, you should first understand how the fieldRenderer is working. It kicks off a pipeline called 'renderField'.
In the second step of this, it's reading the fieldvalue:
Replace that one with your own custom class with something like this:
Something in the line of:
But now with error checks :)
根据 Sitecore 官方文档,字段名称在各部分中必须是唯一的。
此处
Per official Sitecore Documentation, field names must me unique across sections.
This was also discussed here