Click here to Skip to main content
15,847,653 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Ok my friends.
I am about to come to the conclusion that the detailsview is either the devil, or just doesn't like me! :)

1. This is an ASP.NET web application using C#
2. I am not using sql datasource,, I am using a web service call
that populates the data via an object collection.

Here is my issue,

I have a detailsview that I am using to display data, as well as allow the user to edit and/or insert new records.

Everything is set up, and everything is working... so what is the issue?

This -- When the detailsview is initially displayed, it is in ReadOnly mode. This means at the bottom, my command buttons are "Edit" and "New"
These are to edit the current record shown, or insert a new record.

When I click on "Edit" for the first time, NOTHING Happens! If I click "Edit" a second time, it works fine!
The "New" button works fine, on any click, even the first.

I have looked everywhere and I cannot find a solution for this!

If anyone has ran into this, please, please, please let me know how you were able to resolve this.

Thank you!

Thank you for your response.
I suppose I should have given better information on this.
Here is what happens,
The first time it is clicked, it does hit the ModeChanging Event in my code, it just doesn't switch over to Edit mode. The second time it is clicked, it does switch to edit mode. - no errors are thrown.
Here is my code:
<asp:DetailsView ID="dv" runat="server"
OnItemUpdated="dv_ItemUpdated" >
...some fields
protected void dv_ModeChanging(object sender, DetailsViewModeEventArgs e)
//see if we need to rebind the details view
if (e.NewMode == DetailsViewMode.ReadOnly)

Thanks again
Updated 11-Mar-10 7:05am

1 solution

There is some issue with your code only. Somehow your first edit event is cancelled or not raised.

Try to find that, use debugger of VS(also enable all exceptions). If not able to, Post the necessary piece of code here.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900