I have added the FCKeditor to my ASP.NET pages, it seems to work, I enter words fine in the box, it saves in the Access database but it changes the html tags so when it is read from the database it doesnt display the html as it should..
e.g. When applying bold to a word - Should Be stored in the database as: <b>Hello</b> and not <p><b>Hello</b></p>
I can manually type in the html code into the database and it will work fine so it must be when it is storing it fromt he asp page to the database.
Here is a copy of the code i am using on the asp.net page:
Andy
e.g. When applying bold to a word - Should Be stored in the database as: <b>Hello</b> and not <p><b>Hello</b></p>
I can manually type in the html code into the database and it will work fine so it must be when it is storing it fromt he asp page to the database.
Here is a copy of the code i am using on the asp.net page:
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2"%>
<%@ Page Language="vb" Debug=true ValidateRequest="false" %>
<%@ import Namespace="System.Data.OLEDB" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- #INCLUDE FILE="include.aspx" -->
<!-- #INCLUDE FILE="menu.aspx" -->
<html>
<head>
<title>Edit Project</title>
<script language="JavaScript" src="preview.js"></script>
<script runat="server" language="vb">
dim preview as string
Sub Page_Load(sender As Object, e As EventArgs)
if session("loggedin") = "" then
response.redirect("login.aspx")
end if
Dim queryvalue = Request.QueryString("id")
if Page.IsPostBack then
If (IsNumeric(queryvalue)) then
dim ProjectNameupdate as string = request.form("ProjectName")
ProjectNameupdate = replace(ProjectNameupdate,"'", "''")
Dim strSQL As String = "UPDATE tblProject SET ProjectDesc = '" & request.form("ProjectDesc") & "', ProjectName = '" & ProjectNameupdate & "' where ProjectID = " & queryvalue & ";"
Dim myConn As New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbsource & "")
Dim Cmd As New OleDbCommand(strSQL, Myconn)
MyConn.Open()
Cmd.ExecuteReader()
MyConn.Close()
end if
end if
If (IsNumeric(queryvalue)) then
Dim query As String = "Select ProjectDesc, ProjectName FROM tblProject WHERE ProjectID = " & queryvalue & ";"
Dim myConn As New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbsource & "")
Dim myCmd As OleDbCommand = New OleDbCommand(query, myConn)
myConn.Open()
Dim myReader As OleDbDataReader = myCmd.ExecuteReader()
While myReader.Read()
ProjectName.text = (myReader("ProjectName").tostring)
ProjectDesc.Value = (myReader("ProjectDesc").tostring)
End While
'close connections'
myReader.Close()
myConn.Close()
MyConn = Nothing
preview = "default.aspx?id=" & queryvalue & ""
Else
End if
End Sub
</script>
<head>
<body style="font-family: Arial, Helvetica, sans-serif;">
<form RunAt="server">
<b>Project Title:</b><br>
<asp:TextBox Id="ProjectName" RunAt="server" ReadOnly="false" AutoPostBack="false" />
<br/><br/>
<b>Project Information:</b>
<br/>
<FCKeditorV2:FCKeditor ID="ProjectDesc" EnableXHTML="true" BasePath="~/FCKeditor/" runat="server"></FCKeditorV2:FCKeditor>
<br/>
<input type="submit" value="Save"> | <input type="button" value="Preview" onClick="window.open('<%=(preview)%>', 'new', 'width=600,height=500')"><br/>
</form>
</body>
</html>
Andy

Re: ASPNET HTML Code Storing Problem
-James
Re: ASPNET HTML Code Storing Problem
I have tried setting to True but same result, does the information need to be decoded before displaying on another page? If so can someone tell me the code needed, I am new to ASP.NET and especially new to FCKeditor..
Andy
Re: ASPNET HTML Code Storing Problem
Re: ASPNET HTML Code Storing Problem
Actually, I have a business object containing much more than the HTML ... things such as a template ID, effective date, approver ID, approved date, etc. I just capture the HTML as one of the properties for the object and write the whole thing out to SQL Server.
Just out of curiosity, if you have the Source button displayed in FCKeditor's toolbar, click on it to see how the editor is seeing the raw HTML.