Hi Friends
What events fire when binding data to a data grid?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Nov 29, 2011, 12:54 PM
ItemCreated:
The ItemCreated event is fired when an item in a DataGrid control is created. This means that at the time the event is fired, the DataGrid does not yet know about the data that will be bound to it. So, if the logic of your method depends on this data being available to the control, you're better off using the ItemDataBound event. Other than that, the ItemCreate event differentiates itself in one other way from the ItemDataBound event: the ItemCreated event is raised when data is bound to the control and during round-trips (postbacks). These qualities make the event especially well-suited to add custom attributes to a DataRow (such as onmouseover or other javascript events) or to control the appearance in ways that do not depend on the data within the DataRow (such as making every 10th row a different color).
ItemDataBound:
The ItemDataBound event is fired after after an item in a DataGrid control is bound. This means that (unlike the ItemCreated event) you can add special formatting to a DataRow that is dependent upon the data contained within that row. Since ItemDataBound is fired after the ItemCreated event, it is within this event that you are presented with the final opportunity to access the data before it is rendered to the client. These qualities make the event well-suited for changing the appearance of a row or cell based on the data within that row or cell (such as highlighting outliers or other important information).
Refer
http://www.eggheadcafe.com/community/visual-studio/7/10016647/what-events-fire-when-binding-data-to-a-data-grid-what-are-they-good-for.aspx
Thanks