Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 12, 2006 07:09 PM by bmains
Jan 11, 2006 06:36 PM|LINK
I'm confused to the difference that CreateChildControls and PerformDataBinding have in the CompositeDataBoundControl; would anybody have an example with this control, or understand the differences in purpose?
Jan 11, 2006 06:55 PM|LINK
I am going through the same thing right now...
In a DataBoundControl, you override CreateChildControls and PerformDataBinding seperately. In the CompositeDataBoundControl, you just override CreateChildControls. According to MSDN, you shouldn't override PerformDataBinding in the CompositeDataBoundControl.
What I've seen in CreateChildControls is that when dataBinding == true, the dataSource contains the data selected by the data source control. If dataBinding == false, then dataSource is an array of null objects, the length of which is the number you returned
from that method last time...I haven't found out why this is useful.
This article has a good method for saving data and preventing unnecessary databinding.
Jan 12, 2006 11:42 AM|LINK
Thanks for the information, that makes sense. The array of null objects is useful because you are supposed to loop through and create the child controls; the viewstate will then load the information back in. I remember reading that from Nikhil Kothari's
ASP.NET server controls book.
Thanks for your help.
Jan 12, 2006 02:01 PM|LINK
Jan 12, 2006 07:09 PM|LINK
I'm reading that from the book I have; it states that whenever creating a new tablerow (example was creating a table), as soon as the table row is loaded from the "blank" data source, theviewstate is loaded for that row.