Difference between Databound & Databind
I want to know the difference between OnDataBound() & OnDataBinding() in Grid view in Asp.net webforms. When these events are triggered in the Page life cycle.
回答
DataBinding
is triggered when the grid begins to bind data, but DataBound
is triggered when all grid data is bound to the grid. Both of them are custom events of a grid control (or other data-bindable control) and executes in the page life cycle when the control events executes (in stage postback event handling).
Control.DataBinding Event
Occurs when the server control binds to a data source.
Remarks
This event notifies the server control to perform any data-binding logic that has been written for it.
BaseDataBoundControl.DataBound Event
Occurs after the server control binds to a data source.
Remarks
This event notifies the server control that any data binding logic written for it has completed.
For more information about how to handle events, see Handling and Raising Events.