Placing a custom button anywhere inside the bar of buttons causes the text value to be incorrect

  •  08-23-2007, 9:20 AM

    Placing a custom button anywhere inside the bar of buttons causes the text value to be incorrect

    I don't know if you can help with this. It is a bit of a strange bug. We have been trying to add a custom button (to generate our own insert link popup - connecting to pages in the database). Everything works fine, unless we actually place the custom button anywhere inside the bar with the rest of the buttons. As long as it is either above it or bellow it things will work however.

    What happens is that the value of the editor can not be read anymore the .text value won't include thing added in there anymore. Unless it was already in there on load. To illustrate in our CMS:

    1) We load a page from the database. It's current content is loaded inside the cuteeditor so a user can change it.
    2) The user makes changes
    3) the user saves

    (same idea for a new page, then an empty cuteeditor will display)

    Now if we include a custom button the editor's text property just won't have any new text. If the text before was "Hello world" and I added 'Hello wonderfull world" it would on postback again be "Hello world".

    If we add the custom button above or bellow the other standard buttons. Then everything saves just fine. We have tried multiple ways to add the button and to create the button. Incl. from various examples found on the support forum. I will copy/paste just one of ways we tried to illustrate (ceEditor is the cuteeditor).

    This works fine:
            WebControl ctrl = ceEditor.CreateCommandButton("MyButton", "link.gif", "Insert My Custom Link");
            ctrl.Attributes["onclick"] = "var popUp = openPop();CuteEditor_GetEditor(this).ExecCommand('PasteHTML',false,popUp); ";
            this.ceEditor.InsertToolControl(0, "MyButton", ctrl);

    This already stops working:
            Button bcLink = new Button();
            bcLink.Text = "Link";
            System.Web.UI.Control container = this.ceEditor.ToolControls[0].Control;
            container.Controls.Add(bcLink);

    Sorry for the bad examples. It's been an entire day of trying out various things so not all code has been saved. We've also tried to add it through the config. Same problem. Just as soon as we in any possible way add a custom button "among the other buttons" it goes wrong. When it get's it's own "line" so to say, it works fine.

View Complete Thread