|
 |
aspx_beginners thread: Why are there TWO bubble events from ONE click?
Message #1 by "Jon Maz" <jonmaz@s...> on Wed, 24 Apr 2002 17:38:37
|
|
Hi,
I can't work out why clicking ONCE on the button in User_Control.ascx
causes TWO bubble events to fire in the parent page Main_Page.aspx (all
code below).
Both events are reported in the main page as having the same source object
(unsurprisingly, the button), but have different event arguments (the
first "System.EventArgs", the
second "System.Web.UI.WebControls.CommandEventArgs").
Can anyone tell me what on earth is going on?
Thanks!
JON
++++++++++++++++++++++++++++++
MAIN_PAGE.aspx
++++++++++++++++++++++++++++++
<%@ Page Language="VB" %>
<%@ Register TagPrefix="LHS" TagName="UserControl" src="User_Control.ascx"
%>
<script language="VB" runat="server">
Protected Overrides Function OnBubbleEvent(obj As Object, e As EventArgs)
As Boolean
Context.Response.Write("<br><br>Parent Control's BubbleEvent is
called.")
Context.Response.Write("<br>Source of event is:" & obj.ToString())
Context.Response.Write("<br>EventArgs are:" & e.ToString())
Return True
End Function
</script>
<html>
<body>
<form runat="server">
<LHS:UserControl runat="server" id="LHSUserControl" />
</form>
</body>
</html>
++++++++++++++++++++++++++++++
USER_CONTROL.ascx
++++++++++++++++++++++++++++++
<%@ Control Language="VB" %>
<script language="VB" runat="server">
Public Sub FireEvent(obj as object, e as eventargs)
RaiseBubbleEvent(obj, e)
End sub
</script>
<asp:Button runat="server" Text="Add Person" OnClick="FireEvent" />
Message #2 by "Steven A Smith" <ssmith@a...> on Wed, 24 Apr 2002 12:41:33 -0400
|
|
Try adding AutoEventWireup=false to your Page directive.
Steve
----- Original Message -----
From: "Jon Maz" <jonmaz@s...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Wednesday, April 24, 2002 5:38 PM
Subject: [aspx_beginners] Why are there TWO bubble events from ONE click?
> Hi,
>
> I can't work out why clicking ONCE on the button in User_Control.ascx
> causes TWO bubble events to fire in the parent page Main_Page.aspx (all
> code below).
>
> Both events are reported in the main page as having the same source object
> (unsurprisingly, the button), but have different event arguments (the
> first "System.EventArgs", the
> second "System.Web.UI.WebControls.CommandEventArgs").
>
> Can anyone tell me what on earth is going on?
>
> Thanks!
>
> JON
>
>
>
>
>
>
> ++++++++++++++++++++++++++++++
> MAIN_PAGE.aspx
> ++++++++++++++++++++++++++++++
>
>
> <%@ Page Language="VB" %>
>
> <%@ Register TagPrefix="LHS" TagName="UserControl" src="User_Control.ascx"
> %>
>
> <script language="VB" runat="server">
>
> Protected Overrides Function OnBubbleEvent(obj As Object, e As EventArgs)
> As Boolean
> Context.Response.Write("<br><br>Parent Control's BubbleEvent is
> called.")
> Context.Response.Write("<br>Source of event is:" & obj.ToString())
> Context.Response.Write("<br>EventArgs are:" & e.ToString())
> Return True
> End Function
>
>
> </script>
>
> <html>
> <body>
> <form runat="server">
>
> <LHS:UserControl runat="server" id="LHSUserControl" />
>
> </form>
> </body>
> </html>
>
>
>
>
> ++++++++++++++++++++++++++++++
> USER_CONTROL.ascx
> ++++++++++++++++++++++++++++++
>
>
>
> <%@ Control Language="VB" %>
>
> <script language="VB" runat="server">
>
> Public Sub FireEvent(obj as object, e as eventargs)
> RaiseBubbleEvent(obj, e)
> End sub
>
> </script>
>
> <asp:Button runat="server" Text="Add Person" OnClick="FireEvent" />
>
>
>
>
Message #3 by "Jon Maz" <jonmaz@s...> on Wed, 24 Apr 2002 18:01:44
|
|
Hi,
I changed the first line on MAIN_PAGE.aspx to
<%@ Page Language="VB" AutoEventWireup="false" %>
and it doesn't seem to have helped - I'm still getting the same TWO bubble
events as before.
Any other ideas?
Thanks,
JON
|
|
 |