event bubble

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Gao

    event bubble

    Hello friends

    I'm trying to perform event bubble on a user control from the example on


    but this example doesn't work... when I run the code it says BubbleControl
    does not exist which makes sense as nothing was assigned to BubbleControl.. .
    I'm just curious if I should assign because I did try assigning
    BubbleControl with a new instance but still it did not assign the event to
    BubbleControl.B ubbleClick on the user control side.

    Just wondering if anyone know how to do this.

    Thanks
    Tom

    public class WebForm1 : System.Web.UI.P age
    {
    protected WebUserControl1 BubbleControl;

    private void Page_Load(objec t sender, System.EventArg s e)
    {
    Response.Write( "WebForm1 :: Page_Load <BR>");
    }

    #region Web Form Designer generated code
    override protected void OnInit(EventArg s e)
    {
    InitializeCompo nent();
    base.OnInit(e);
    }

    private void InitializeCompo nent()
    {
    this.Load += new System.EventHan dler(this.Page_ Load);
    BubbleControl.B ubbleClick += new EventHandler(We bForm1_BubbleCl ick);
    }
    #endregion

    private void WebForm1_Bubble Click(object sender, EventArgs e)
    {
    Response.Write( "WebForm1 :: WebForm1_Bubble Click from " +
    sender.GetType( ).ToString() + "<BR>");
    }
    }####### control public class WebUserControl1 : System.Web.UI.U serControl
    {
    protected System.Web.UI.W ebControls.Butt on Button1;
    protected System.Web.UI.W ebControls.Pane l Panel1;

    private void Page_Load(objec t sender, System.EventArg s e)
    {
    Response.Write( "WebUserControl 1 :: Page_Load <BR>");
    }

    private void Button1_Click(o bject sender, System.EventArg s e)
    {
    Response.Write( "WebUserControl 1 :: Begin Button1_Click <BR>");
    OnBubbleClick(e );
    Response.Write( "WebUserControl 1 :: End Button1_Click <BR>");
    }

    public event EventHandler BubbleClick;

    protected void OnBubbleClick(E ventArgs e)
    {
    if(BubbleClick != null)
    {
    BubbleClick(thi s, e);
    }
    }

    #region Web Form Designer generated code
    override protected void OnInit(EventArg s e)
    {
    InitializeCompo nent();
    base.OnInit(e);
    }

    private void InitializeCompo nent()
    {
    this.Button1.Cl ick += new System.EventHan dler(this.Butto n1_Click);
    this.Load += new System.EventHan dler(this.Page_ Load);

    }
    #endregion

    }


  • Anders Borum

    #2
    Re: event bubble

    Please post asp.net related questions to
    microsoft.publi c.dotnet.framew ork.aspnet

    --
    venlig hilsen / with regards
    anders borum
    --


    Comment

    • Tom Gao

      #3
      Re: event bubble

      errr... why ?

      it would take me 1 week to get a response there ?

      whats the difference anyway ? this is C# and I'm using C#

      Thanks
      Tom

      "Anders Borum" <anders@spherew orks.dk> wrote in message
      news:uPhiiTt1EH A.1152@TK2MSFTN GP14.phx.gbl...[color=blue]
      > Please post asp.net related questions to
      > microsoft.publi c.dotnet.framew ork.aspnet
      >
      > --
      > venlig hilsen / with regards
      > anders borum
      > --
      >
      >[/color]


      Comment

      • Tom Gao

        #4
        Re: event bubble

        if you got the time why don't you answer my question ? does it matter where
        I post ?

        I think you're wasting my post thread

        so please go annoy someone else

        "Anders Borum" <anders@spherew orks.dk> wrote in message
        news:uPhiiTt1EH A.1152@TK2MSFTN GP14.phx.gbl...[color=blue]
        > Please post asp.net related questions to
        > microsoft.publi c.dotnet.framew ork.aspnet
        >
        > --
        > venlig hilsen / with regards
        > anders borum
        > --
        >
        >[/color]


        Comment

        • Anders Borum

          #5
          Re: event bubble

          Hello!
          [color=blue]
          > does it matter where I post ?[/color]

          No. Microsoft obviously created the different newsgroups just for fun with
          no real intention of grouping related technologies (phun intended).
          [color=blue]
          > I think you're wasting my post thread
          >
          > so please go annoy someone else[/color]

          I would be careful about talking to other people like that. Especially when
          you're in a position asking for help.

          --
          venlig hilsen / with regards
          anders borum
          --


          Comment

          • Jon Skeet [C# MVP]

            #6
            Re: event bubble

            Tom Gao <tomgaomail@opt ushome.com.au> wrote:[color=blue]
            > errr... why ?
            >
            > it would take me 1 week to get a response there ?[/color]

            I'm sure it won't if you make a good request (eg with full sample
            code).
            [color=blue]
            > whats the difference anyway ? this is C# and I'm using C#[/color]

            Just because you're using C# doesn't mean that it's a question *about*
            C#.

            This is twice in two days that you've been rude in a response. Are you
            always like this with people who are trying to help you? If you keep
            going like this, you're unlikely to get *any* help after a while. Why
            would anyone want to respond to you if you're just going to be rude
            back?

            --
            Jon Skeet - <skeet@pobox.co m>
            Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

            If replying to the group, please do not mail me too

            Comment

            Working...