Sitecore inline editing on other items

拟墨画扇 提交于 2019-12-08 05:57:34

问题


I was told to do inline editing for Sitecore web site.

It is working for the simple page like an article page.

<sc:text ID="sct1" ruat="server" ... />

But if the page is more complicated, it is impossible now, i believe.

Sample page like ..

About Us will have 3 different radio buttons.

According to the button chosen, the respective content will show. That content is actually a child content of About Us.

And if I want inline editing, i have to check whether it is the editing mode

If so, I can show all 3 set contents.

And the user can edit it. But when he saves, only the main page is saved. the child pages are not saved.

Do we have an alternate solution for that?


回答1:


Your assertion is incorrect that when the page is saved, that only the item being rendered is saved. If you output a field from any item using a field renderer (as sc:text does behind the scenes), Sitecore will track that the item has been edited, and save the changes made.

You can populate the Item or Datasource property on sc:text in order to edit a field from another item.

Example syntax when data binding an Item object:

<sc:Text runat="server" ID="uxNameText" Field="Name" Item="<%#Container.DataItem%>" />

Or Datasource can be used to bind an item path (not recommended) or ID (a bit better):

<sc:Link Field="Link" DataSource="/sitecore/content/home" runat="server" />

You can also populate either Item or Datasource in your codebehind.

As an alternative, utilize a framework such as Custom Item Generator to create a .NET class that will allow you to easily output field values from any item in a way that will support inline editing.

References:

http://blog.velir.com/index.php/2010/10/19/custom-item-generator/

http://www.techphoria414.com/Blog?tag=custom+item+generator



来源:https://stackoverflow.com/questions/14432903/sitecore-inline-editing-on-other-items

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!