Problem 1: When clicking on the Edit button the DetailsView will not change the mode until the second click. The edit button required two clicks to change the mode to Edit instead of ReadOnly.
I solved this problem by changing the mode in the ModeChanging event handler and then rebinding the DetailsView control.
ModeChanging Event Handler:
protected void dvOrder_ModeChanging(object sender, DetailsViewModeEventArgs e)
if (e.NewMode != DetailsViewMode.Insert)
Problem 2: When clicking the update button I handle the updating of the order in the ItemUpdating event but the ItemUpdated never fires and the DetailsView never change the mode to ReadOnly after the data was updated. DetailsView control always stayed on the Edit Mode.
I solve this problem by canceling the ItemUpdating event, changing the mode, and rebinding the details view data source.
ItemUpdating Event Handler:
protected void dvOrder_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
e.Cancel = true;
This was the only way I got things to worked for me. The ItemUpdated event never fired but I got the DetailsView to works how I wanted. I wish there was an easier way to do this or at least more documentation on Microsoft’s website.