Adding a button via config file (or code behind but dont know what method to override)

Last post 08-28-2007, 8:08 AM by Domainscanners. 2 replies.
Sort Posts: Previous Next
  •  08-27-2007, 5:18 AM 32920

    Adding a button via config file (or code behind but dont know what method to override)

    Have just realised I posted this question in the "ASP" forum instead of here. Apologies
     
    Can someone please provide an example to show how to add a button via config file?
     
    I was guessing something like this...
     
    <item type="image" name="mybutton" onclick="ShowMyDialog(this)" imagename="mypic.jpg"/>
    The onclick does not work and the image does not show?
     
    I managed to get it working in my codebehind file but can only get it to work as the first button in the toolbar (I want it to be the last one) I think this is because the toolbar has not rendered yet. Im overrideing CreateChildControls but am not sure what method to place the code in? I have tried downloading the class reference but all I get is "page is not found" once I launch the help files.
     

    protected override void CreateChildControls()

    {

    base.CreateChildControls();

    this._lbl = new Label();

    this.Controls.Add(_lbl);

    this._tb.ConfigurationPath = "/CS/RTFEditor/Configuration/AutoConfigure/DropZoneDesigner_Basic.config";

     

    this._tb.Width = Unit.Percentage(100);

    // Themes/Custom/Images/youtube.jpg

    WebControl ctrl = this._tb.CreateCommandButton("MyButton", "mypic.jpg", "my button tooltip");

    ctrl.Attributes["onclick"] = "ShowMyDialog(this)";

    // Add custom button into the editor

    this._tb.InsertToolControl(0, "MyButton", ctrl); // This inserts button at beginning of toolbar. Want it at end

    this.Controls.Add(_tb);

    }

  •  08-27-2007, 1:22 PM 32945 in reply to 32920

    Re: Adding a button via config file (or code behind but dont know what method to override)

    Domainscanners,
     
    Please use the following method to add custom button:

    http://cutesoft.net/example/customization.aspx
     
     
    Add custom dialog:
     
    Add a Cross Browser Modal Dialog Box to Cute Editor

    How to create a custom button(client side) which displays a dialog?( C# | VB )

    This example demonstrates how easy it can be to add your own client side buttons to the CuteEditor by creating a Cross Browser Modal Dialog Box.

     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  08-28-2007, 8:08 AM 32982 in reply to 32945

    Re: Adding a button via config file (or code behind but dont know what method to override)

    Thanks again for your help Adam,
     
    The problem was with my code. I was trying to add the new button before I had actually added CE to my web parts control.
    Following code snippet soved the problem. Note how im adding the button after I add CE to the control (Just incase anyone makes the same mistake)...
     

    // Add ce first

    this.Controls.Add(_tb);

    // Now add custom button into the editor

    WebControl ctrl = this._tb.CreateCommandButton("MyButton", "video.jpg", "Insert Video");

    ctrl.Attributes["onclick"] = "ShowMyDialog(this)";

    this._tb.InsertToolControl(_tb.ToolControls.IndexOf("InsertDocument") + 1, "MyButton", ctrl);
     
    Paul.
View as RSS news feed in XML