Hi,
I want to know that what is real meaning of event bubbling in ASP.Net controls and explain with example?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Feb 29, 2012, 11:52 PM
"Event bubbling" is allows a child control to propagate events up its control hierarchy. Event bubbling enables events to be raised from a more convenient location in the controls hierarchy and allows event handlers to be attached to the child control as well as to the control that exposes the bubbled event i.e. parent control
Event bubbling is mostly used in the data-bound controls like Repeater, DataList, and DataGrid that expose command events raised by child controls up to top-level events.
for example, the DataList control exposes Command events from controls in its template as ItemCommand events.
hope this help.
Banketeshvar NarayanPosted Feb 29, 2012, 12:48 PM
The ASP.NET page framework provides a technique called event bubbling that allows a child control to propagate events up its containment hierarchy.It is attached to the original control as well as to the control that exposes the bubbled event.
Event bubbling is basically used with Data-bound controls like: Repeater, DataList, DataGrid, GridView etc.Example:
suppose there is a GridView which is having an ImageButton or simply a Button.
When you click on that button GridView_RowCommand() event will be fired and you can handle this click of button on GridView_RowCommand().
But if you want to handle the button click event on that particular button_click
event then you have generate bubble event.
To generate Bubble event follow these steps:
1.Clck on Gridview SmartTag.
2.Select edit Template.
3.Choose Button and double click on it.
4. It will generate a new Click event code for button.
This event is known as bubbling events.
Why We need Bubble Events:
As we know that we can not find any Child control of GridView directly with its name we have to use FindControl Method for that. So If we need to fire an event code on that buton click not willing to handle it on RowCommand() then we can use bubble event.
You can also visit http://bnarayansharma.wordpress.com/2012/02/29/event-bubbling/
B Narayan.