Prev | Current Page 394 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"


The method GetData is called within PerformSelect and takes a callback method as a parameter.
The callback method is OnDataSourceViewSelectCallback, which calls PerformDataBinding to
build out the control via the CreateControlHierarchy method. Once again, whether the control
is bound to an IDataSource-based control or not determines how the control tree is built by
passing in different parameters to CreateControlHierarchy.
As you would guess, DataBind takes precedence as a control-loading mechanism when
binding to a data source. It is called on the web form after the data source has been linked to
the control.
The first task of DataBind is to fire the data-binding event OnDataBinding. If the Repeater
control is binding to a design-time data source, firing this event in DataBind is required for the
control to see the selected design-time data source at runtime.
Next, DataBind starts with a clean slate, clearing the current set of controls and any ViewState
values that are lingering, after which the control is ready to track ViewState. As shown in the
preceding code, once the table has been set, DataBind builds the child control hierarchy
based on the data source through the CreateControlHierarchy method. It then sets the
ChildControlsCreated property to true to let ASP.


Pages:
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406