2009-02-05 41 views
1

我有一個數據源連接到一個存儲過程,將返回一個記錄適用於特定的頁面,對於另一個類似的情況(填充標題信息),我把一箇中繼器圍繞標題html,並使用綁定表達式將數據獲取到標題中。但是,現在我遇到了另一個不起作用的問題。TinyMCE和ASP.NET數據綁定問題

我的頁面有一部分使用與標題相同的數據源的數據,它是一個註釋部分。數據源中有一個備註字段,它是一個包含HTML的varchar(max)。

我用TinyMCE爲筆記創建了一個豐富的編輯器,但是我想用編輯器填充數據源返回的Notes字段內容。因此,如果TextAreas可以在中繼器中,我會設置,因爲我認爲我可以在文本區域中填充html,而TinyMCE會將其修復(我在一些測試文本週圍用大膽的標籤進行測試,並且它是正確的處理)。

是否有另一種方法可以使用Databinding Eval表達式填充TinyMCE可以理解的文本區域或其他內容,以便在加載頁面時填充富文本編輯器?

我在此嘗試看起來像:

<asp:Repeater ID="NotesRepeater" runat="server" DataSourceID="SheetParams"> 
<textarea style="clear:both; font-size:large" name="notes"> 
<%# Eval("Notes") %> 
</textarea> 
</asp:Repeater> 

而且我有

tinyMCE.init({ 
    theme: "advanced", 
    mode: "textareas", 
    width: "95%", 
    theme_advanced_buttons1: "bold, italic, underline, strikethrough,|, justifyleft, justifycenter, justifyright, justifyfull,|,formatselect,fontsizeselect", 
    theme_advanced_buttons2: "cut, copy, paste,|,bullist, numlist,|,outdent, indent,|,undo,redo", 
    theme_advanced_buttons3: "" 
}); 

TinyMCE的設置,但當然,我得到的錯誤多行文本不能嵌套在轉發器。

回答

3

你需要用的textarea的一個ItemTemplate標籤,它的工作:

<asp:Repeater ID="NotesRepeater" runat="server" DataSourceID="SheetParams"> 
    <ItemTemplate> 
     <textarea style="clear:both; font-size:large" name="notes">   
     <%# Eval("Notes") %> 
     </textarea> 
    <ItemTemplate> 
</asp:Repeater> 
+0

難道不應該的ItemTemplate左右textarea的,而不是在它裏面? – 2009-02-05 13:15:37