2014-03-19 26 views
0

在sitecore頁面編輯器模式下按鈕的文字很奇怪;我從sitecore字典中獲取此文本。在頁面編輯器模式下查看輸入字段值的htmlSitecore頁面編輯器asp:按鈕文字

<input 
    id='fld_148D7F085F66448D912345030DDBBEBC_2BA3454A9A9C4CDFA9F8107FD484EB6E_en_1_3f45b5b727dc4c93a537e7f688aa6808_1063' 
    class='scFieldValue' 
    name='fld_148D7F085F66448D912345030DDBBEBC_2BA3454A9A9C4CDFA9F8107FD484EB6E_en_1_3f45b5b727dc4c93a537e7f688aa6808_1063' 
    type='hidden' 
    value="Sign Up" 
/> 

<span class="scChromeData"> 
{ "commands": 
    [ 
     { "click": "chrome:common:edititem({command:\"webedit:open\"})", 
      "header": "Edit the related item", 
      "icon": "/temp/IconCache/SoftwareV2/16x16/cubes_blue.png", 
      "disabledIcon": "/temp/cubes_blue_disabled16x16.png", 
      "isDivider": false, 
      "tooltip": "Edit this item in the Content Editor.", 
      "type": "common" 
     }, 
     { "click": "chrome:rendering:personalize({command:\"webedit:personalize\"})", 
      "header": "Personalize","icon":"/temp/IconCache/PeopleV2/16x16/users3_edit.png", 
      "disabledIcon": "/temp/users3_edit_disabled16x16.png", 
      "isDivider": false, 
      "tooltip": "Personalize component.", 
      "type": "sticky" 
     }, 
     { "click": "chrome:rendering:editvariations({command:\"webedit:editvariations\"})", 
      "header": "Edit variations", 
      "icon": "/temp/IconCache/SoftwareV2/16x16/breakpoints.png", 
      "disabledIcon": "/temp/breakpoints_disabled16x16.png", 
      "isDivider": false, 
      "tooltip": "Edit the variations.", 
      "type": "sticky" 
     } 
    ], 
    "contextItemUri":"sitecore://master/{148D7F08-5F66-448D-9123-45030DDBBEBC}?lang=en&ver=1", 
    "custom":{}, 
    "displayName":"Phrase", 
    "expandedDisplayName":null 
} 
</span> 
<span scFieldType="memo" 
     contenteditable="true" 
     class="scWebEditInput" 
     id="fld_148D7F085F66448D912345030DDBBEBC_2BA3454A9A9C4CDFA9F8107FD484EB6E_en_1_3f45b5b727dc4c93a537e7f688aa6808_1063_edit"> 
Sign Up 
</span> 

在正常模式下,輸入字段值爲「註冊」。

這隻發生在按鈕+頁面編輯器的組合中。

可能是有益的,如果我給我的代碼從Sitecore的

public static string GetDictionaryItem(string expression) 
    { 
     string val = String.Empty; 
     Item currentItem = Context.Database.GetItem(String.Concat("/sitecore/system/dictionary",expression)); 
     if (currentItem != null) 
     { 
      val = FieldRenderer.Render(currentItem, "Phrase"); 
     } 
     return val; 
    } 

任何建議得到字典項目?

+0

你應該張貼渲染的標記(即告訴我們你是如何渲染按鈕)。 –

+0

你能檢查你的頁面上是否有

?我看到一個類似的問題,並添加表單標籤幫助我。 – 2014-03-19 13:40:47

+0

謝謝,同樣的想法。更新了文章 –

回答

3

那麼,它做什麼它應該做的事...
您返回FieldRenderer,所以如果你在頁面編輯器模式是將渲染,而不只是文字可編輯字段。

如果你只想在所有渲染模式的文本,然後你的方法更改爲:

public static string GetDictionaryItem(string expression) 
{ 
    Item currentItem = Context.Database.GetItem(String.Concat("/sitecore/system/dictionary",expression)); 

    if (currentItem != null) 
    { 
     return currentItem["Phrase"] ?? string.Empty; 
    } 

    return string.Empty; 
} 
+0

這個解決方案應該解決這個問題,而不是現在編輯頁面編輯器中的按鈕文本;因爲它只是文本。我將解決方案中的asp:button更改爲asp:linkbutton with inside.Hope它會幫助一些人。 –

相關問題