Why do I have to click Edit twice on the DetailsView?

If you need to click a DetailsView Edit button twice before it goes into Edit mode, you are probably not handling its ModeChanging event properly.

A little background: You can add an Edit button to the DetailsView by setting its AutoGenerateEditButton property to true. You must also handle the DetailsView ModeChanging event as follows:


protected void mmDetailsView1_ModeChanging(object sender, DetailsViewModeEventArgs e)
    {
        if (e.NewMode == DetailsViewMode.Edit)
        {
            mmDetailsView1.ChangeMode(DetailsViewMode.Edit);
            this.Order.GetOrdersByOrderID(10248);
        }
    }

Notice that after changing the mode to Edit, the DetailsView control is re-bound.


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 06/18/08
Comment or report problem with topic