adding custom toolbar button

Last post 12-17-2003, 6:06 PM by Adam. 1 replies.
Sort Posts: Previous Next
  •  12-17-2003, 4:33 PM 130

    adding custom toolbar button

    I've created a custom toolbar button, and added it to the toolbar with "toolbar.Add" method, as described in the sample files.
    The button always appear as the first button in the toolbar, and I'd like to insert the button at a specific place in the toolbar.


    I've tried ".toolbar.Controls.AddAt" method, but all index values above 0 terminates with: Specified argument was out of the range of valid values. Parameter name: index.

    The toolbar is populated in Page_Load method with:
    myEditor.Template = "Cut,Copy,Paste,PasteText,PasteWord,Separator"
    myEditor.toolbar.Controls.AddAt(5,myCustomButton)

    How do I add my custom button at a specific location in the toolbar?

  •  12-17-2003, 6:06 PM 132 in reply to 130

    Re: adding custom toolbar button

     A custom button (Inert the current time)

    System.Web.UI.WebControls.Image Image1 = new System.Web.UI.WebControls.Image ();
    Image1.ToolTip = "Insert the current time";
    Image1.ImageUrl = HttpContext.Current.Request.ApplicationPath +"/timer.gif";
    Image1.CssClass = "button";
    Image1.Attributes.Add("onclick","var d = new Date(); Paste_Html('Editor1',d.toLocaleTimeString())"); Image1.Attributes.Add("type","btn");


    Add your custom button at a specific location

     Editor1.toolbar.Add(Editor1.Bold);
     Editor1.toolbar.Add(Editor1.Italic);
     Editor1.toolbar.Add(Image1);   Add your custom button here
     Editor1.toolbar.Add(Editor1.Underline);  
     Editor1.toolbar.Add(Editor1.Separator);


    Put the rest of buttons to the Template property.

    <CE:Editor id="Editor1" runat="server" Template="JustifyLeft,JustifyCenter,JustifyRight,Separator,FontColor,HighLight"></CE:Editor>

    If you have any further question, please let me know.

    Adam


    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

View as RSS news feed in XML