Ok my friends.
I am about to come to the conclusion that the detailsview is either the devil, or just doesn't like me! :)
Backstory:
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"
Width="500px"
AllowPaging="false"
AutoGenerateEditButton="true"
AutoGenerateRows="false"
AutoGenerateInsertButton="false"
BorderStyle="None"
GridLines="Horizontal"
DataKeyNames="ID"
OnDataBound="dv_OnDataBound"
OnModeChanging="dv_ModeChanging"
OnItemUpdating="dv_ItemUpdating"
OnItemUpdated="dv_ItemUpdated" >
<Fields>
...some fields
</Fields>
</asp:DetailsView>
protected void dv_ModeChanging(object sender, DetailsViewModeEventArgs e)
{
dv.ChangeMode(e.NewMode);
//see if we need to rebind the details view
if (e.NewMode == DetailsViewMode.ReadOnly)
this.BindDetails();
}
Thanks again