ItemCreated is basically there for you to interact with UI things, and yes, you can do the exact same thing on the ItemDataBound event as well/create your UI changes there too... i prefer DataBound because then the data is already there, but i understand the purpose of ItemCreated
ASP.NET DataGrid ItemDataBound Event
문제
DataGrid has 2 events:
ASP.NET DataGrid:
ItemCreated
ItemDataBound
When you bind to a data source ItemCreated gets fired followed by ItemDataBound.
I need to know if anyone can think of any good reason of using ItemCreated
.
I can't find anything versus putting the whole code in ItemDataBound
event(other than keep the event handler's code smaller).
Please let me know if you think otherwise.
해결책 3
다른 팁
ItemCreated is fired on the postbacks, but ItemDataBound only during databinding.
ItemCreated
is fired before the data bind actually happens. You would normally put code dealing with the appearance and non bound content of the grid in this event.
ItemDataBound
is fired after the data bind. You would normally put code dealing with the data here.
제휴하지 않습니다 StackOverflow