2013-02-18 50 views
2

我需要使用editframe讓前用戶修改一些複選框領域Sitecore的:editframe

  1. 我創建了一個新的編輯框按鈕,並設置只,我想前用戶編輯這些字段。例如:Core DB - >/sitecore/content/Applications/WebEdit/Edit Frame Buttons /(編輯按鈕文件夾)/(field editor button)。在由前端用戶編輯的字段中,我將其設置爲標題。

  2. 在我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> 
    
  3. 代碼背後

    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> 

回答

2

您是否嘗試過設置Editframe的DatasSource?

例如EditField.DataSource = item.Paths.FullPath;

+0

然後編輯框將需要在ItemTemplate中。 – techphoria414 2013-02-18 13:03:12

+0

@ techphoria414你的意思是編輯框只能在數據模板中使用嗎?即使我使用sublayout通過使用數據綁定來顯示來自其他模板的其他字段,而不工作? – WenHao 2013-02-19 00:53:58

+0

不,我的意思是EditFrame一次只能編輯一個項目,AFAIK。你做對了。 – techphoria414 2013-02-19 15:33:51

0

你幾乎在那裏。不應該使用「FullPath」。試試這個代替

DataSource="<%# ((Sitecore.Data.Items.Item)Container.DataItem).Paths.FullPath %>"