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

  •  08-27-2007, 5:18 AM

    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);

    }

View Complete Thread