Ext.net裡面放置KindEditor富文字框(解決KindEditor不顯示和後台取不到值的問題)

來源:互聯網
上載者:User

標籤:

上周六,從上午10點到晚上12點終於搞定了Ext.net與KindEditor的相容性問題。對於Ext.net的原理,我是菜鳥,表示不懂。我遇到的兩個問題是,問題一是不顯示KindEditor控制項,通過ext:ResourceManager裡面的 <DocumentReady Handler="createEditor();" /> 解決了,問題二是KindEditor控制項的值傳不會後台去,就是在前台也收不到值,但是我通過點擊全屏按鈕後就可以收到其值了,於是採用<Click OnEvent="BtnAddSave_Click" Before="editor.fullscreen(false);">的方式來解決了。下面就直接貼代碼。由於代碼過多,我直接貼重點代碼。

1.aspx頭部代碼:

<script type="text/javascript">
//載入編輯器
var editor;
function createEditor() {
editor = KindEditor.create("#txtAddContent", {
resizeType: 1,
uploadJson: ‘../../tools/upload_ajax.ashx?action=EditorFile&IsWater=0‘,
fileManagerJson: ‘../../tools/upload_ajax.ashx?action=ManagerFile‘,
allowFileManager: true,
fullscreenMode:false
});
}
</script>

2.body裡面的代碼第1處:

<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="liuqing">
<Listeners>
<DocumentReady Handler="createEditor();" />
</Listeners>
</ext:ResourceManager>

3.body裡面的代碼第2處:

<ext:Container runat="server" Title="內容" Collapsible="true" AnchorHorizontal="95%">
<Content>
<textarea id="txtAddContent" name="txtAddContent" style="width: 99%;
height: 350px;visibility: hidden;" runat="server"></textarea>
</Content>
</ext:Container>

4.body裡面的代碼第3處:

<ext:Button ID="BtnAddSave" runat="server" Text="儲存" Icon="Disk">
<DirectEvents>
<Click OnEvent="BtnAddSave_Click" Before="editor.fullscreen(false);">
<EventMask ShowMask="true" Msg="正在儲存" />
</Click>
</DirectEvents>
</ext:Button>

5.後台CS 代碼:

 string Content = this.txtAddContent.Value.Trim();

 

Ext.net裡面放置KindEditor富文字框(解決KindEditor不顯示和後台取不到值的問題)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.