Search code examples
c#asp.netsqlfckeditor

how to obtain a value in FCK editor?


i have a problem with FCK editor. i want to obtain a value in the Fck editor, the editor is in a form view and i cant use Find Control to reach it. U may ask dude why do u want to obtain value in Fck? because i'm trying to write a Update code and my one field must have FCK editor.

i mean i can use Find Control to reach my textboxes in my FormView like that;

TextBox txt_my_text=(TextBox)FormView1.FindControl("TextBox1");

and then i can use its value like that cmd.Parametres.Add("@param",txt_my_text.Text);

but i wanna reach the Fck Editors value, please help.


Solution

  • You do it in the same way as with any other server control (ex a textbox).

    FckEditor editor = new FckEditor(); //You need to create a new instance of the editor
    var abcd = editor.Value; 
    

    What you do is create a new instance of the FckEditor class.

    Also probably best to HtmlEncode the value:

    var abcd = server.Htmlencode( editor.Value;)