473,378 Members | 1,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

event bubble

Hello friends

I'm trying to perform event bubble on a user control from the example on
http://odetocode.com/Articles/94.aspx

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.BubbleClick on the user control side.

Just wondering if anyone know how to do this.

Thanks
Tom

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

private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("WebForm1 :: Page_Load <BR>");
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}

private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
BubbleControl.BubbleClick += new EventHandler(WebForm1_BubbleClick);
}
#endregion

private void WebForm1_BubbleClick(object sender, EventArgs e)
{
Response.Write("WebForm1 :: WebForm1_BubbleClick from " +
sender.GetType().ToString() + "<BR>");
}
}####### control public class WebUserControl1 : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Panel Panel1;

private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("WebUserControl1 :: Page_Load <BR>");
}

private void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("WebUserControl1 :: Begin Button1_Click <BR>");
OnBubbleClick(e);
Response.Write("WebUserControl1 :: End Button1_Click <BR>");
}

public event EventHandler BubbleClick;

protected void OnBubbleClick(EventArgs e)
{
if(BubbleClick != null)
{
BubbleClick(this, e);
}
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}

private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

}
Nov 16 '05 #1
5 6813
Please post asp.net related questions to
microsoft.public.dotnet.framework.aspnet

--
venlig hilsen / with regards
anders borum
--
Nov 16 '05 #2
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" <an****@sphereworks.dk> wrote in message
news:uP**************@TK2MSFTNGP14.phx.gbl...
Please post asp.net related questions to
microsoft.public.dotnet.framework.aspnet

--
venlig hilsen / with regards
anders borum
--

Nov 16 '05 #3
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" <an****@sphereworks.dk> wrote in message
news:uP**************@TK2MSFTNGP14.phx.gbl...
Please post asp.net related questions to
microsoft.public.dotnet.framework.aspnet

--
venlig hilsen / with regards
anders borum
--

Nov 16 '05 #4
Hello!
does it matter where I post ?
No. Microsoft obviously created the different newsgroups just for fun with
no real intention of grouping related technologies (phun intended).
I think you're wasting my post thread

so please go annoy someone else


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
--
Nov 16 '05 #5
Tom Gao <to********@optushome.com.au> wrote:
errr... why ?

it would take me 1 week to get a response there ?
I'm sure it won't if you make a good request (eg with full sample
code).
whats the difference anyway ? this is C# and I'm using C#


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 - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: kj | last post by:
How does one trigger an event programmatically? I'm interested in how to do this in both the "Level 0" event model as well as in the DOM Level 2 event model. Thanks! kj -- NOTE: In my...
2
by: Kirk Is | last post by:
Hi there. I'm trying to improve a simple javascript based graphics editor for Atari 2600 games (long story) with better use of CSS and Javascript. I'm a little weak on what CSS can and can't...
10
by: David | last post by:
Is there something that I can use to prevent the a user from dragging something, an image for instance. In IE I can use the ondrag = "return false;", is there a way to achieve the same way with...
1
by: Lucifer | last post by:
Hi I am trying to raise a bubble event. I have a dropdownlist and a datalist in a datalist. I want to use the postback from the dropdownlist to rebind the nested datalist. But i need the...
0
by: Nathan Sokalski | last post by:
I am using a DataList with Event Bubbling. When I bubble an event, the ItemCommand event is always called before the bubble event specified in the CommandName property. Is this ASP.NET's way of...
17
by: dan_williams | last post by:
I have the following test web page:- <html> <head><title>Test</title> <script language="Javascript"> <!-- function fnTR() { alert("TR"); }
0
by: shapper | last post by:
Hello, I have a few custom controls organized as follows: Parent Child Section User User control raises an event named Updated. This event has custom arguments of type UpdatedEventArgs.
6
by: Jeremy | last post by:
I've got a floating div which becomes visible when a link is clicked. I want the div to be hidden when the user clicks anywhere on the page except for whithin the div. What is the best way to do...
4
by: webgour | last post by:
Hello, I'm having difficulty using attachEvent instead of simply assigning to mouseover in my object Sample03. When i use myImage.onmouseover = this.showmouseover(); in the following all works...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.