Howto: insert a custom image/button in the toolbar and capture the command event in C# codebehind?

Last post 02-12-2009, 1:53 PM by Domainscanners. 3 replies.
Sort Posts: Previous Next
  •  09-02-2004, 1:44 PM 1693

    Howto: insert a custom image/button in the toolbar and capture the command event in C# codebehind?

    Hi.

     
    Doubt 1: Can´t insert and image/button in the CE toolbar:
     

    System.Web.UI.WebControls.Image myImg = new System.Web.UI.WebControls.Image();

    myImg.ImageUrl = "~/CuteEditor_files/myImg.gif";

    myImg.Attributes.Add("onclick","MyMethod()");

    myImg.Attributes.Add("type","btn");

    Editor1.RegisterCustomButton(myImg);

     
    Results: The image doesn´t appear in the Editor1 Toolbar
     
    Doubt 2: Suppose I have a method in my .cs file called
     
    private void MyMethod()
    {
        DoSomething...
    }
     
    Task: How to call MyMethod() considering Doubt1 is solved?

    Regards,
    »»» KenA
  •  09-02-2004, 2:02 PM 1694 in reply to 1693

    Re: Howto: insert a custom image/button in the toolbar and capture the command event in C# codebehind?

     
    After you regsiter your custom button. You need use implement it in your editor Template as followings:
     
    Template="Bold, Italic, myImg"

    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

  •  09-02-2004, 2:25 PM 1695 in reply to 1694

    Re: Howto: insert a custom image/button in the toolbar and capture the command event in C# codebehind?

    Ok, now I see my Image,
     
    System.Web.UI.WebControls.ImageButton customToolbarImg1 = new System.Web.UI.WebControls.ImageButton();

    customToolbarImg1.ImageUrl = "~/Editor_Resources/Themes/Office2003/save.gif";

    customToolbarImg1.ID = "customToolbarImg1";

    customToolbarImg1.Click += new ImageClickEventHandler( customToolbarImg1_Click );

    ce1.RegisterCustomButton(customToolbarImg1);

     
    but
     
    Now when I click this image I want to call my c# method:
     
    private void customToolbarImg1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        ....
    }
     
    This is NOT working????

    Regards,
    »»» KenA
  •  02-12-2009, 1:53 PM 48693 in reply to 1695

    Re: Howto: insert a custom image/button in the toolbar and capture the command event in C# codebehind?

    I have exactly the same problem
View as RSS news feed in XML