locked
CreateChildControls vs. PerformDataBinding RRS feed

  • Question

  • User-239001081 posted

    Hello there,


    After reading a few articles I am trying to summarize the difference between CreateChildControls and PerformDataBinding.

    In the PerformDataBinding we have access to the data so we can use this routine for building the controls tree based on the data rows stored in the PerformDataBinding data parameter. In the CreateChildControls we have no access to the data and we can set the general attributes for the control, like displaying or hiding part of the custom control.


    Am I missing anything?

    Monday, April 25, 2011 5:25 AM

Answers

  • User-16411453 posted

    CreateChildControls is a method of iterating through a collection or composition of code behind objects, that will then be added to the htmltextwriter collection on the server side. The htmltextwriter is then processed by the server, and return to the users webbrowser as html markup code to create the page that was requested.

    PerformDatabinding is a function that handles the automatic binding of data to a object that is databinding aware or ready. This process occurs after createChildControls, in the page lifecycle. If the object does not exist first, then you cannot bind data to it. Normally you bind data in the Page_Load cycle of the page life cycle.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 26, 2011 3:19 PM