我想在后端获取tinymce的内容但是我结束时没有返回值。
这就是我所拥有的:
HTML标记:
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" src="/tinymce/js/tinymce/tinymce.min.js"></script>
<div style="margin-top: 50px;">
<span>Set content for left side content</span>
<script type="text/javascript">
tinymce.init({
selector: "textarea",
theme: "modern",
image_advtab: true,
templates: [
{title: 'Test template 1', content: 'Test 1'},
{title: 'Test template 2', content: 'Test 2'}
]
});
</script>
<textarea id="leftContent" runat="server" name="content" style="width:100%"></textarea>
</div>
<div style="margin-top: 50px;">
<span>Set content for right side content</span>
<script type="text/javascript">
tinymce.init({
selector: "textarea",
theme: "modern",
image_advtab: true,
templates: [
{ title: 'Test template 1', content: 'Test 1' },
{ title: 'Test template 2', content: 'Test 2' }
]
});
</script>
<textarea id="rightContent" runat="server" name="content" style="width:100%"></textarea>
</div>
<div style="margin-top: 20px;" class="row">
<asp:Button runat="server" ID="btnSave" Text="Save" OnClick="btnSave_OnClick" CssClass="btn btn-success pull-right"/>
</div>
</asp:Content>
后端:
protected void btnSave_OnClick(object sender, EventArgs e)
{
string test = leftContent.InnerHtml;
string t2 = rightContent.InnerHtml;
}
知道我做错了什么吗?
谢谢,Laziale
答案 0 :(得分:0)
您可以尝试按下按钮时调用以下内容:
tinymce.triggerSave();
然后使用tinymce.get('leftContent').getContent();
直接使用更新的textarea内容或编辑器内容发送编辑器内容