Wednesday, December 29, 2010

What Is Event Bubbling ?

What Is Event Bubbling?


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

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Best Wallpapers collections