HTML Editor problem CMS 5

Vote:
 

Have added the EPiServer Editor to a page and it works great.

Now I want to fill it with content when a you select a value from adropdownlist and click a button, but I can't get it to work.

Does anybody now how?

#29772
May 13, 2009 11:11
Vote:
 

Hi Daniel,

I've already answered for your question on my blog ( http://marekmusielak.blogspot.com/2009/03/episerver-rich-text-editor.html )

What you need to do is to set Text property of one of the child controls of the editor:

   protected override void OnInit(EventArgs e)
   {
      base.OnInit(e);
      if (!Page.ClientScript.IsClientScriptIncludeRegistered("system.js"))
      {
         Page.ClientScript.RegisterClientScriptInclude("system.js",
            ((PageBase) Page).ResolveUrlFromUI("javascript/system.js"));
         Page.ClientScript.RegisterClientScriptInclude("system.aspx",
            ((PageBase) Page).ResolveUrlFromUI("javascript/system.aspx"));
         Page.ClientScript.RegisterClientScriptInclude("episerverscriptmanager.js",
            ((PageBase) Page).ResolveUrlFromUtil(
            "javascript/EPiServerScriptManager.js"));
       }
    myHtmlEditor.InnerProperty = new PropertyLongString {EditorToolOptions = EditorToolOption.All};
    }
    protected void btnFill_Click(object sender, EventArgs e)
    {
       ((HtmlEditor) myHtmlEditor.Controls[0].Controls[0]).Text = ddlOptions.SelectedValue;
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
       SetValuesForPropertyControls(myHtmlEditor);
       litMessage.Text = myHtmlEditor.PropertyValue as string;
       pnlMessage.Visible = true;
    } 

Here is the fully functional source code for what you need:

http://marasm.pl/resources/resource.php?HtmlEditorPlusFill.zip

#29774
Edited, May 13, 2009 12:26
Vote:
 
Thanks, that worked perfectly Laughing
#29775
May 13, 2009 12:50
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.