how can i add a button to the toolbar programmatically?

Last post 10-19-2012, 7:22 AM by Kenneth. 3 replies.
Sort Posts: Previous Next
  •  10-18-2012, 4:45 AM 75011

    how can i add a button to the toolbar programmatically?

    I have a cute editor for .net in my page.

     

    the toolbar have a custome buttons initilized on page_load.

     

    all fine by now.

     

    i want to add another only one button to the last toolbar programmatically,

     

    is there any way to do so? how?

     

    thanks 

  •  10-18-2012, 7:13 AM 75012 in reply to 75011

    Re: how can i add a button to the toolbar programmatically?

    Hi dubi,

     

    The example page below shows you how to add the custom button to the end of the toolbar.

     

    1. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>  
    2.   
    3. <%@ Page Language="c#" %>  
    4.   
    5. <html>  
    6. <head>  
    7.     <title>example</title>  
    8. </head>  
    9.   
    10. <script runat="server">  
    11.     private void Page_Load(object sender, System.EventArgs e)  
    12.     {  
    13.         //get last button index  
    14.         int pos = Editor1.ToolControls.IndexOf("JustifyRight") + 1;  
    15.         WebControl ctrl = Editor1.CreateCommandButton("MyButton""text.gif""Insert My Custom Text");  
    16.         ctrl.Attributes["onclick"] = "alert('test');";  
    17.         //add this custom button into the editor as last index  
    18.         Editor1.InsertToolControl(pos, "MyButton", ctrl);  
    19.     }  
    20. </script>  
    21.   
    22. <body>  
    23.     <form runat="server" id="Form1">  
    24.         <CE:Editor ID="Editor1" AutoConfigure="Minimal" runat="server" />  
    25.     </form>  
    26. </body>  
    27. </html>  
     

    Regards,

     

    Ken 

  •  10-18-2012, 8:29 AM 75018 in reply to 75012

    Re: how can i add a button to the toolbar programmatically?

    I meant to add NOT costum button.

     

    i have a configuration file, and i want to add to that toolbar insert link of the cute editor button programmatically.

     

    how to? 

  •  10-19-2012, 7:22 AM 75033 in reply to 75018

    Re: how can i add a button to the toolbar programmatically?

    Hi dubi,

     

    I am not very clear what is your requirement. Can you explain it in detail?

     

    What you want to add into the editor toolbar  programmatically?

     

    Regards,

     

    Ken 

View as RSS news feed in XML