Hi ,
This is naveen, we are using FCKeditor in my project. it is working fine IE. But when i am trying to test in Mozill(3.0). If i eidit the text area and click on save button in code behind page i am geeting old value only.
Eg:-
i have property LongDesc
formload
{
LongDesc ="Hello sir";
ctlFCKEditor.value = LongDesc;
}
btnSaveClick()
{
LongDesc = ctlFCKEditor.value ;
//If i check longdesc value same "Hello sir" even though i have edit that value to "Hello madam". This is working fine in IE. please let me know any one knows solution for this issue.
}
Thanks
Naveen M
This is naveen, we are using FCKeditor in my project. it is working fine IE. But when i am trying to test in Mozill(3.0). If i eidit the text area and click on save button in code behind page i am geeting old value only.
Eg:-
i have property LongDesc
formload
{
LongDesc ="Hello sir";
ctlFCKEditor.value = LongDesc;
}
btnSaveClick()
{
LongDesc = ctlFCKEditor.value ;
//If i check longdesc value same "Hello sir" even though i have edit that value to "Hello madam". This is working fine in IE. please let me know any one knows solution for this issue.
}
Thanks
Naveen M
Re: FCKeditor working for IE but not for Mozilla
Find the following blog by him
Easy way to get FCKEditor to work inside an ASP.Net AJAX UpdatePanel
By Josh | March 30, 2007
The Problem
I had a MultiLine TextBox inside an UpdatePanel and I wanted that TextBox to have rich editing capabilities so I chose FCKEditor. But, now when I do a partial PostBack, the TextBox doesnt retain it value.
An Initial Solution
So, I searched for a solution to this problem and found this post, but it seemed like more of a hack than I prefer.
A More Elegant Solution
As it turns out, there is a much simpler way hinted at in the FCKEditor wiki:
private void Page_Load(object sender, EventArgs args)
{
Page.ClientScript.RegisterOnSubmitStatement(
editor.GetType(),
"editor",
"FCKeditorAPI.GetInstance('" + editor.ClientID + "').UpdateLinkedField();");
}
If you have multiple FCKEditors, you need to apply this solution to each one:
private void Page_Load(object sender, EventArgs args)
{
Page.ClientScript.RegisterOnSubmitStatement(
editor1.GetType(),
"editor1",
"FCKeditorAPI.GetInstance('" + editor1.ClientID + "').UpdateLinkedField();");
Page.ClientScript.RegisterOnSubmitStatement(
editor2.GetType(),
"editor2",
"FCKeditorAPI.GetInstance('" + editor2.ClientID + "').UpdateLinkedField();");
}
One Small Problem
There is one small issue with this solution, however—there will be JavaScript errors if you hide the TextBox during a partial PostBack.
For example, if you have a three step form: edit, review, and then publish. On the edit step the TextBox is shown and you enter and style your rich text, then you click the review button and this causes a partial PostBack which removed the TextBox and shows a preview of the text you enterred. When you click the publish button there will be a JavaScript error because the Textbox is no longer visible.
The Final Solution
To solve this problem and come to an elegant, working solution I just needed to add in some basic error checking. Since the JavaScript was getting a little more complex, I decided to move the main work into a .js file:
function FCKUpdateLinkedField(id)
{
try
{
if(typeof(FCKeditorAPI) == "object")
{
FCKeditorAPI.GetInstance(id).UpdateLinkedField();
}
}
catch(err)
{
}
}
And the page code now looks like:
private void Page_Load(object sender, EventArgs args)
{
Page.ClientScript.RegisterOnSubmitStatement(
editor.GetType(),
"editor",
"FCKUpdateLinkedField('" + editor.ClientID + "');");
}