我需要使用editframe讓前用戶修改一些複選框領域Sitecore的:editframe
我創建了一個新的編輯框按鈕,並設置只,我想前用戶編輯這些字段。例如:Core DB - >/sitecore/content/Applications/WebEdit/Edit Frame Buttons /(編輯按鈕文件夾)/(field editor button)。在由前端用戶編輯的字段中,我將其設置爲標題。
在我sublayout,我有這樣的代碼
<sc:EditFrame ID="EditField" runat="server" Buttons="/sitecore/content/Applications/WebEdit/Edit Frame Buttons/EditFields"> <div id="whatyoumissed"> <asp:ListView ID="ListView1" runat="server"> <LayoutTemplate> <ul style="list-style-type: none;" > <asp:PlaceHolder runat="server" ID="itemplaceholder"></asp:PlaceHolder> </ul> </LayoutTemplate> <ItemTemplate> <li style="float: left;margin-left:20px;"> <sc:FieldRenderer ID="FieldRenderer2" runat="server" FieldName="Headline" Item="<%# Container.DataItem as Sitecore.Data.Items.Item %>" /> <br /> <sc:FieldRenderer ID="FR3" runat="server" FieldName="cb" Item="<%# Container.DataItem as Sitecore.Data.Items.Item %>" /> </li> </ItemTemplate> </asp:ListView> </div> </sc:EditFrame>
代碼背後
string queryPath = "/bla/bla/bla/bla/bla/bla/bla/bla/bla"; var item = sc.Context.Database.GetItem(queryPath); var children = item.Children; ListView1.DataSource = children; ListView1.DataBind();
當我點擊頁面編輯器中編輯框上,在彈出的對話框不有我的領域(標題)來修改它。任何建議?
答: 我Sitecore的編輯框的數據源的谷歌升技與此鏈接 http://blog.jan.hebnes.dk/2011/12/using-sitecore-editframe-with.html
而不是使用後面的代碼最終如由馬亭博斯,我修改我的代碼從分組到以下。
<asp:ListView ID="ListView1" runat="server">
<LayoutTemplate>
<ul style="list-style-type: none;" >
<asp:PlaceHolder runat="server" ID="itemplaceholder"></asp:PlaceHolder>
</ul>
</LayoutTemplate>
<ItemTemplate>
<sc:EditFrame ID="EditField" runat="server" Buttons="/sitecore/content/Applications/WebEdit/Edit Frame Buttons/EditFields"
DataSource="<%# ((Sitecore.Data.Items.Item)Container.DataItem).Paths.FullPath %>" >
<li style="float: left;margin-left:20px;">
<sc:FieldRenderer ID="FieldRenderer2" runat="server" FieldName="Headline"
Item="<%# Container.DataItem as Sitecore.Data.Items.Item %>" /> <br />
<sc:FieldRenderer ID="FR3" runat="server" FieldName="cb" Item="<%# Container.DataItem as Sitecore.Data.Items.Item %>" />
</li>
</sc:EditFrame>
</ItemTemplate>
</asp:ListView>
然後編輯框將需要在ItemTemplate中。 – techphoria414 2013-02-18 13:03:12
@ techphoria414你的意思是編輯框只能在數據模板中使用嗎?即使我使用sublayout通過使用數據綁定來顯示來自其他模板的其他字段,而不工作? – WenHao 2013-02-19 00:53:58
不,我的意思是EditFrame一次只能編輯一個項目,AFAIK。你做對了。 – techphoria414 2013-02-19 15:33:51