Double Customer Buttons by using AutoEventWireup="true"

Last post 07-08-2004, 4:37 AM by mfilthau. 2 replies.
Sort Posts: Previous Next
  •  07-01-2004, 1:21 PM 1145

    Double Customer Buttons by using AutoEventWireup="true"

    Hi,

     
    I use AutoEventWireup="true" in my Page.
     
    Also I add the following code in Page_Load():
     
     

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

    Image1.ToolTip = "Exit Editor";

    Image1.ImageUrl = HttpContext.Current.Request.ApplicationPath +"/images/save.gif";

    Image1.CssClass = "button";

    Image1.Attributes.Add("onclick","location='" + Request.Params["file"] + "'");

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

    Editor1.toolbar.Add(Image1);
     
    I see my customer Button twice. If I set AutoEventWireup="false"  the it's ok.
     
    I need AutoEventWireup="true" for Customer Error Pages.
     
    Regards Marc
  •  07-05-2004, 1:58 PM 1161 in reply to 1145

    Re: Double Customer Buttons by using AutoEventWireup="true"

    Marc,

     
    When you have AutoEventWireup="true" in your @Page directive, ASP.NET automatically binds Page_Load to the OnLoad event. Your page
    class does this explicitly, so you have the event handler bound twice to the same method.
     
    That's the reason you got Double Customer Buttons.

    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

  •  07-08-2004, 4:37 AM 1194 in reply to 1161

    Re: Double Customer Buttons by using AutoEventWireup="true"

    Thanks,

     
    with a bool in Page_Load() everthing is fine now.
     
    Regards Marc
View as RSS news feed in XML