根据 Sitecore CMS 中的某些条件动态更改上下文元素
我在 Sitecore CMS 下拥有用户控制权。它有一些控件绑定到上下文的某些字段。例如:
<sc:text runat="server" field="HomePage_WelcomeText"></sc:text>
我有基于同一模板的不同内容项,我需要在 PageLoad() 中更改其中一些内容的上下文。例如,如果 URLReferer 具有特定值,我希望在上下文中具有特定内容项。
有什么提示吗?
I have user control under Sitecore CMS. It has some controls bound to some fields of context. For example:
<sc:text runat="server" field="HomePage_WelcomeText"></sc:text>
I have different content items based on the same template and I need to change context to some of them in PageLoad(). For example, if URLRefferer has certain value I want to have certain content item in context.
Any hints?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
sc:text
控件有一个名为Item
的公共属性,它采用Sitecore.Data.Items.Item
。因此,为您的控件提供一个 ID 属性,然后在Page_Load
上您可以根据需要动态设置该 Item 属性。The
sc:text
control has a public property calledItem
that takes aSitecore.Data.Items.Item
. So, give your control an ID attribute, then onPage_Load
you can dynamically set that Item property as needed.