Timing of database operations in ASP.NET page lifecycle
According 开发者_运维百科to the msdn documentation, as you can see on the diagram, a server control's "Data binding events" occurs after all "control changed events". So in the case of a DetailsView control, the ItemInserted event would happen before the database operation? Obviously this cannot be correct?
Check out the MSDN article for the control's event.
In the case of a DetailsView.ItemInserted Event:
The ItemInserted event is raised when an Insert button within the DetailsView control is clicked, but after the insert operation. This allows you to provide an event handler that performs a custom routine, such as checking the results of the insert operation, whenever this event occurs.
There is also the DetailsView.ItemInserting Event that is raised before the insert to the database
精彩评论