7
Reply

what is mean by event bubbling in ASP.net

Avinash Aher

Avinash Aher

10y
20k
1
Reply

    For every control in asp.net there are some pre defined events which could be handled for example let us take a button which has an OnClick() event when ever a single click is made to that button that event raises.But if that particular button is in any of the following Server controls like GridView,Repeater,DataList etc . We cannot retrieve the button onClick() event directly. For that let us consider we have the same button in GridView.Here Button is the child control where as the parent control is our Gridview. These child controls do not raise by themselves when they are inside any server controls , they pass the event to the container parent and from then it is passed to our page as "ItemCommand". From the code behind we cann access button onclick event now with that ItemCommand Event of Parent control.This process of sending the child control events to parent control is said to be Event Bubbling.For more details you can check below link http://aspdotnetcodebook.blogspot.com/2009/11/event-bubbling-in-aspnet.html

    Go through thathttp://www.c-sharpcorner.com/Forums/Thread/159341/event bubbling means -- suppose u have gridview and in that gridview you take checkbox .when you clicked on checkbox that event pass to the parent means gridview

    Simply calling a parent control's event from a child control is called Event bubbling. Handling child controls events through parent control in data bind controls known as event bubbling. Server controls like Datagrid, DataList, and Repeater can have other child controls inside them.Example DataGrid can have combo box inside datagrid. These child control do not raise there events by themselves, rather they pass the event to the container parent (which can be a datagrid, datalist, repeater), which passed to the page as "ItemCommand" event. As the child control send events to parent it is termed as event bubbling.

    When Parent control contains child controls. when events occurred in child controls ,the event is bubbled to the parent control.This is called event bubbling.

    Event bubbling is used by the data-bound controls (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 (events whose event data class derives from CommandEventArgs), any event defined on a server control can be bubbled.For Example Grid Control When you Select Dropdown value is its autopost back property True then the event of child control call its calling Event bubbling .

    Event bubbling means event propogation from child control to it's parent container. It 's not related to only c# or .net. Event bubling is present in javascript as well , please refer this link for details http://javascript.info/tutorial/bubbling-and-capturing

    http://msdn.microsoft.com/en-us/library/aa719644(v=vs.71).aspx