ASP.Net Object Data Source - Data Binding

会有一股神秘感。 提交于 2019-12-11 07:48:40

问题


At what point does a ASP.Net Object Data Source bind data, from the specified data source, in the page life cycle?


回答1:


From the Page Life Cycle Overview, referring to the databinding event:

This event is raised by data-bound controls before the PreRender event of the containing control (or of the Page object) and marks the beginning of binding the control to the data.

And regarding the DataBound event:

This event marks the end of data-binding operations in a data-bound control. In a GridView control, data binding is complete for all rows and any child controls. Use this event to format data bound content or to initiate data binding in other controls that depend on values from the current control's content.




回答2:


As Joel stated, binding happens in PreRender. If your really interested you can take a look at BaseDataBoundControl.OnPreRender and you'll see the code that is responsible for this.



来源:https://stackoverflow.com/questions/547862/asp-net-object-data-source-data-binding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!