Event bubbling is term which is used to denote the fallback representation of events on controls. Suppose, you have three Div's inside an HTML file one above the other and on top you also have a button. So, what happens behind the scene when you click that button is:
Browser invokes the 'click' event on that button first > then it propagates down the road invokes click event on the Div right below the button, propagates down > invokes click event for second div from the top... and it continues doing this until it hits the document object. It means, finally the browser hits the click event on "document" object and then it stops.
So, whenever an event is captured and propagates down the road till the last/root control/element (document object in case of a browser), it's called event bubbling. It doesn't necessarily has to be a browser always, I just took it for example.
In ASP.NET, Event bubbling is used by the data-bound controls like Repeater, DataList, and DataGrid, to expose command events raised by child controls (within item templates) as top-level events. While ASP.NET server controls in the .NET Framework use event bubbling for command events, any event defined on a server control can be bubbled.
Hope now you understand what exactly event bubbling is.
Sunny SharmaPosted Feb 1, 2014, 7:29 AM
Event bubbling is term which is used to denote the fallback representation of events on controls. Suppose, you have three Div's inside an HTML file one above the other and on top you also have a button. So, what happens behind the scene when you click that button is:
Browser invokes the 'click' event on that button first > then it propagates down the road invokes click event on the Div right below the button, propagates down > invokes click event for second div from the top... and it continues doing this until it hits the document object. It means, finally the browser hits the click event on "document" object and then it stops.
So, whenever an event is captured and propagates down the road till the last/root control/element (document object in case of a browser), it's called event bubbling. It doesn't necessarily has to be a browser always, I just took it for example.
In ASP.NET, Event bubbling is used by the data-bound controls like Repeater, DataList, and DataGrid, to expose command events raised by child controls (within item templates) as top-level events. While ASP.NET server controls in the .NET Framework use event bubbling for command events, any event defined on a server control can be bubbled.
Hope now you understand what exactly event bubbling is.
Happy learning :)