views:

1102

answers:

1

Over in this question, Scott writes that it is possible to get the current HTML for what's written in the FCKeditor by using FCKeditorAPI.__Instances['instanceNameHere'].GetHTML();

Could someone provide step-by-step instructions on how to accomplish this in an ASP.NET page? All I currently have so far in the .aspx file is this:

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Page Title="" Language="C#" ... %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<h2>Create a new piece</h2>
<form id="form1" runat="server">

<FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server">
</FCKeditorV2:FCKeditor>

<input id="Submit1" type="submit" value="Submit" runat="server" />
</form>
</asp:Content>
+3  A: 

In javascript

Well you can do this here:

<script type="text/javascript">
    var oEditor = FCKeditorAPI.GetInstance(’IDFromFCKEditor’);
    oEditor.Events.AttachEvent( 'OnSelectionChange', function() {
        document.getElementById("PreviewDiv").innerHTML = oEditor.GetHTML(true);
    }) ;
</script>

Source http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/JavaScript_API

José Leal
In case anyone needs this later, you will want to wrap the code José provides inside the following:function FCKeditor_OnComplete(editorInstance)
Jedidja
Oh yes, sorry to forget..
José Leal