FCKEditor and ASP.NET

F

Ferret Face

Well, I didn't have much success using the library file he supplied for it.
But I manged to get it working anyway. While scanning through a number of
documents and discussion boards on FCKEditor and ASP.NET I made three
discoveries:

1) The editor had a function that can convert an HTML Text Area into an
HTML I-Frame object and, subsequently, use it as an HTML editor.

2) Multi-line TextBox objects (ASPX) appear as HTML Text Areas on the
client side that have the same object or ID reference.

3) I can register client-side script with the "behind code" for each ASPX
page.

So, to make it all work I:

A) Copied the "FCKEditor" folder into the folder of the web application.

B) Created a multi-line textbox in my ASPX page ("txtBox1" in this case)

C) Registered the following client-side scripts within my VB code:

Private Sub ClientScriptFCKJSLib()
'Register _JavaScript block for centering panel objects on the screen
Dim JavaScriptCode as String = "

RegisterClientScriptBlock("FCKJSLib", JavaScriptCode)
End Sub

Private Sub ClientScriptFCKActivate()
'Register _JavaScript block for Search Incident button (HTML Control)
Dim JavaScriptCode as String = "
&"function ActivateFCKEditor(objName)"& vbCRLF _
&"{"& vbCRLF _
&" var oFCKeditor = new FCKeditor( objName ) ;"& vbCRLF _
&" oFCKeditor.BasePath = './FCKeditor/' ;"& vbCRLF _
&" oFCKeditor.Height = 300 ;"& vbCRLF _
&" oFCKeditor.Width = 600 ;"& vbCRLF _
&" oFCKeditor.ReplaceTextarea() ;"& vbCRLF _
&"} //--> </SCRIPT>"& vbCRLF

If IsClientScriptBlockRegistered("FCKJSLib") Then
RegisterClientScriptBlock("FCKActivate", JavaScriptCode)
End If
End Sub

Private Sub StartupScriptFCKRun()
'Register _JavaScript block for Search Incident button (HTML Control)
Dim JavaScriptCode as String = "
&" ActivateFCKEditor('txtBox1');"& vbCRLF _
&"//--> </SCRIPT>"& vbCRLF

If (IsClientScriptBlockRegistered("FCKJSLib") AND
IsClientScriptBlockRegistered("FCKActivate")) Then
RegisterStartupScript("FCKRun", JavaScriptCode)
End If

End Sub

The first two functions are executed in the Page_Load function. The last
function is supposed to be associated with a command button to activate the
editor.

It's a round-about way but it works.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top