Custom button problem

Last post 08-12-2009, 5:34 AM by Kenneth. 4 replies.
Sort Posts: Previous Next
  •  08-10-2009, 9:17 AM 54608

    Custom button problem

    I am tring to add a custom button but I get 2 buttons se image attached. I am adding it through the code as follows:
    1. CuteEditor.ToolControl tc = txtHTMLFile.ToolControls["RapaportImage"];   
    2.         if (tc != null)   
    3.         {   
    4.             Image Image1 = new Image();   
    5.             Image1.ToolTip = "Insert today's date";   
    6.             Image1.ImageUrl = "rapaport_370x48px.jpg";   
    7.             Image1.CssClass = "CuteEditorButton";   
    8.             Image1.Height = Unit.Pixel(15);   
    9.             SetMouseEvents(Image1);   
    10.             Image1.Attributes["onclick"] = "alert('hello');";   
    11.             tc.Control.Controls.Add(Image1);   
    12.         }  
    and referring to the button through a config file:
    1. <CE:Editor    
    2.   ConfigurationPath="~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/Templates.config"  
    3.   Height="560px" ID="txtHTMLFile" Width="100%" EnableContextMenu="false" runat="server" 
    4.   ResizeMode="None" BreakElement="Br" />  
    in the file I put the following:
    1. <toolbars>  
    2. <item type="image" name="RapaportImage" />  
    the problem:
     
    Thanks for your help
     
    Eli
  •  08-11-2009, 12:39 AM 54626 in reply to 54608

    Re: Custom button problem

    HI esack ,
     
    Try this way
     
    1. Delete this line '<item type="image" name="RapaportImage" /> ' in you config file
     
    2. set toolbar use properties TemplateItemList, like below
     
    <CE:Editor ID="Editor1" runat="server" TemplateItemList="[Bold,Italic][RapaportImage]">
    </CE:Editor>
     
    Regards,
     
    Ken
  •  08-11-2009, 11:44 PM 54639 in reply to 54626

    Re: Custom button problem

    Is this the only solution? I hafe many buttons!
     
    thanks
    Eli
  •  08-12-2009, 4:45 AM 54642 in reply to 54639

    Re: Custom button problem

    Hi
     
    I have been using images like you are trying to do for a couple of years now.
     
    Looking at my code the only difference i can see is in the config file
     
    <item type="image" name="rapaport" />
     
    i have
     
    <item type="holder" name="rapaport" />
     
    Hope this fixes it for you.
     
     
  •  08-12-2009, 5:34 AM 54644 in reply to 54639

    Re: Custom button problem

    Hi esack,
     
    try this way:
     
    1. Delete this line '<item type="image" name="RapaportImage" /> ' in you config file
     
    2. Insert your custom button after 'Save' button
     
     protected override void OnLoad(EventArgs e)
        {
            
            CuteEditor.ToolControl tc = Editor1.ToolControls["Save"];
            if (tc != null)
            {
                Image Image1 = new Image();
                Image1.Attributes["onclick"] = "alert('hello');";
                tc.Control.Controls.Add(Image1);
            }
            base.OnLoad(e);
        }
     
    Regards,
     
    Ken
View as RSS news feed in XML