Upload / insert not working for editor created in code

Last post 05-30-2013, 1:10 PM by Bent Bracke. 4 replies.
Sort Posts: Previous Next
  •  05-29-2013, 10:08 AM 77502

    Upload / insert not working for editor created in code

    Hi

     

    I'm using the following code in an aspx.cs file:

     

    RTE.Editor ed = new RTE.Editor();

    ed.Toolbar = "custom";

    placeholder.Controls.Add(ed);

     

    It creates the editor just fine but clicking on "insert image" gives the following:

     

     

    This is also the case for the insert document dialog.

     

    Clocking upload in those two dialogs results in the following message:

     

     

    NOTE:

     

    if I create the tag manually on the aspx page, then upload works without problems.

     

    <RTE:Editor id="editor" Toolbar="custom" runat="server" />

     

     

     

    Kind regards

    Bent Bracke

     


    BRACKE - bracke.dk
  •  05-29-2013, 12:35 PM 77507 in reply to 77502

    Re: Upload / insert not working for editor created in code

    Hi Bent Bracke,

     

    Please try the example below, does it work for you?

     

    1. <%@ Page Language="c#" ValidateRequest="false" %>  
    2.   
    3. <%@ Register TagPrefix="RTE" Namespace="RTE" Assembly="RichTextEditor" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5. <html xmlns="http://www.w3.org/1999/xhtml">  
    6. <head>  
    7.     <title>example</title>  
    8. </head>  
    9.   
    10. <script runat="server">  
    11.     protected override void OnLoad(EventArgs e)  
    12.     {  
    13.         RTE.Editor ed = new RTE.Editor();  
    14.         ed.ID = "editor1";  
    15.         ed.Toolbar = "custom";  
    16.         placeholder.Controls.Add(ed);  
    17.         base.OnLoad(e);  
    18.     }  
    19. </script>  
    20.   
    21. <body>  
    22.     <form id="Form1" method="post" runat="server">  
    23.         <asp:Panel ID="placeholder" runat="server"></asp:Panel>  
    24.     </form>  
    25. </body>  
    26. </html>  
     

    Regards,

     

    Ken 

  •  05-29-2013, 1:04 PM 77508 in reply to 77507

    Re: Upload / insert not working for editor created in code

    Hi Ken

     

    > Please try the example below, does it work for you?

     

    It works. What is the difference? Is it because its in Onload instead of Page_load?

     

    Kind regards

    Bent Bracke


    BRACKE - bracke.dk
  •  05-30-2013, 12:25 PM 77514 in reply to 77508

    Re: Upload / insert not working for editor created in code

    Hi Bent Bracke,

     

    I think is aobut the id property setting, you did not set the id for the editor.

     

    Regards,

     

    Ken 

  •  05-30-2013, 1:10 PM 77515 in reply to 77514

    Re: Upload / insert not working for editor created in code

    Hi Ken

     

    If i set the id, it still failes :-(


    BRACKE - bracke.dk
View as RSS news feed in XML