Hi, congratulations on a great little editor.
I got it working all right on a VB.NET page and wrote code to have the output displayed below the editor after clicking the Submit button, as you'll see in the code below.
However, I've have spent more than six hours trying to work out how to RETRIEVE THE OUTPUT either by posting to another page or programatically in a subroutine on the same page. I have tried every form of code I can find in books and on this forum.
I've looked through the full package, the code samples in the aspx directory and this forum - and still I cannot retrieve the editor's output for saving to a file with VB.NET.
The file sampleposteddata.aspx in written in C# and doesn't deliver me a string that I can use to save to a file.
It would really help if someone in the team could add a sample page in VB.NET showing how to load the FCKeditor from a file, edit the the file, then save the output back to the file.
Perhaps this is asking too much. If it is, I apologise, but I think I shall have to give up trying to use the FCKeditor with VB.NET - it seems it's for experienced programmers only. And that's a shame because it's a great asset to intermediate programmers like myself.
Here is the code I've used successfully so far ...
<%@ Page ValidateRequest="false" Language="VB" AutoEventWireup="false" %>
<%@ Import Namespace="System.Data" %>
<%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %>
<html> <head> <title>FCKeditor - Sample</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <form runat="server"> <asp:Label ID="lblContents" runat="server" /> <br /> <FCKeditorV2:FCKeditor id="FCKeditor1" BasePath="/FCKeditor/" Width="400px" ToolbarSet="Basic" runat="server"></FCKeditorV2:FCKeditor> <br> <input type="submit" value="Submit" runat="server"> </form> <div style="font-family: verdana; font-size: 76%"> <% dim strContents strContents=Request.Form("FCKeditor1") If strContents<>"" Then Response.Write("<p>" & strContents & "</p>") End If %> </div> </body> </html>
RE: VB.NET problem retrieving data from FCKed
At last I got some VB.NET code to work - it loads a file which you can edit with FCKeditor, then it will save the file by overwriting the original.
As promised, here's the code, but I would appreciate any comments to make it better .....
<%@ Page ValidateRequest="false" Language="VB" %>
<%@ Import Namespace="System.IO" %>
<%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %>
<script runat="server" language="VB">
Sub Page_Load(s As Object, e As EventArgs)
If Not IsPostBack Then
Dim objStreamReader As StreamReader
Dim strInput As String
Dim strSeedData As String
strSeedData = ""
objStreamReader = File.OpenText(MapPath("cgi-bin\story.txt"))
strInput = objStreamReader.ReadLine()
While (strInput <> Nothing)
strSeedData &= strInput
strInput = objStreamReader.ReadLine()
End While
objStreamReader.Close()
FCKeditor1.Value = strSeedData
End If
End Sub
Sub SaveStory(s As Object, e As EventArgs)
Dim strData2Save As String = FCKeditor1.Value.ToString
Dim objStreamWriter As StreamWriter
objStreamWriter = File.CreateText( MapPath("cgi-bin\story.txt"))
objStreamWriter.WriteLine(strData2Save)
objStreamWriter.Close
End Sub
</script>
Thanks to this forum and the documentation, I finally got there !!
I hope this helps others. FCKeditor - or whatever you finally call it - is a great alternative to the commercial products.
Regards,
Keen2Try