我在 FormView 中有一个 ASP.NET 数据绑定文本框,我想在带有 TinyMCE 编辑器的 jQuery UI 对话框中显示它。我已经用附加的编辑器正确显示它
但是当表单被回发(保存到数据库中)时,编辑器中的文本会丢失并且不会被发布。
这是<div>
我用于对话框的标记:
<span id="ExcessiveDutyOfCareWordingDialogLink" style="cursor: hand;">View/Edit Wording</span>
<div id="ExcessiveDutyOfCareWordingDialog" title="Excessive Duty Of Care Wording">
<asp:TextBox runat="server" ID="ExcessiveDutyOfCareWordingTextBox"
Text='<%# Bind("ExcessiveDutyOfCareWording") %>' CssClass="richText" ClientIDMode="Static" />
</div>
以及我用来初始化对话框和编辑器的Javascript,然后在<span>
单击时实际显示它:
$('#ExcessiveDutyOfCareWordingDialog').dialog({ autoOpen: false, height: 300, width: 400, modal: true, resizable: false, buttons: {
Save: function ()
{
// This is from an earlier attempt to fix this problem
// it may be a red herring
tinyMCE.triggerSave();
$(this).dialog("close");
},
Cancel: function ()
{
$(this).dialog("close");
}
}
});
$('#ExcessiveDutyOfCareWordingDialogLink').click(function ()
{
$('#ExcessiveDutyOfCareWordingDialog').dialog('open'); return false;
});
$('.richText').tinymce({
// Location of TinyMCE script
script_url: '/Scripts/tinymce.3.4.5/tiny_mce.js',
theme: "advanced",
theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,cut,copy,paste,|,bullist,numlist,|,undo,redo",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
theme_advanced_buttons4: "",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
width: "100%",
height: "20px"
});
谁能建议我可能做错了什么来解释为什么我会从编辑器中丢失文本?