質問
NicedIt.jsを使用しています。テキストエリアをHTMLエディタに変換しています。負荷だがPOPエラー、
エラー: 'null'はnullまたはオブジェクトではありません
私のTextAreaを以下のように宣言する
bkLib.onDomLoaded(function() {
new nicEditor({iconsPath :'<%=request.getContextPath()%>/images/nicEditorIcons.gif',
maxHeight:345,
buttonList : ['save','bold','italic','underline','left','center','right','justify','ol','ul','fontSize','fontFamily','fontFormat','indent','outdent','image','upload','link','unlink','forecolor','xhtml']}).panelInstance('content');
});
.
誰でもAjaxでNiceditを使用しました
事前感あり
解決
頭をクラックした後、最後に解決策を見つけましたので、Ajaxを介して編集者を含むページを呼び出すときは、TextAreaを宣言してください。 新しいNiceSitor()パネルインスタンス( 'Content');
ではない bklib.ondomloaded(function(){ 新しいNiceSitor()パネルインスタンス(「コンテンツ」); }
他のヒント
私はを使います
new nicEditors.allTextAreas;
.
の代わりにp>
bkLib.onDomLoaded(nicEditors.allTextAreas);
. 基本的に、ASP.NETおよびUPDATEパネルを使用している場合は、コードをコピーすることができます。注:TextArea IDをあなたのために変更することを忘れないでください。
<script type="text/javascript">
//hdnNicEdit: it is a hiddenfield in ASP page.
function SaveContent() {
$("#<%=hdnNicEdit.ClientID %>").val($(".nicEdit-main").html());
}
function pageLoad() {
$(function () {
new nicEditor().panelInstance('here your textarea id');
$(".nicEdit-main").html($("#<%=hdnNicEdit.ClientID %>").val());
})
}
</script>
.
ASPページ:
.
<textarea ID="YOUR TEXTAREA ID" class="form-control" runat="server"></textarea>
<asp:HiddenField ID="hdnNicEdit" runat="server" />
注:onclientClick="SaveContent();"を追加する必要があります。NicedIt TextArea値を保存するボタンに。
サーバー側
テキスト領域の値を取得する:
.string textAreaValue = hdnNicEdit.value;
TextArea値の設定:
.hdnNicEdit.value = "i am setting text into textarea"
詳細: https://dotnetdaily.net/web-development/tutorials/aspdotnet/niceDit-work-update-panel-asp-net