Click here to Skip to main content
15,850,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a detailsview that opens when you select a row in the gridview. It opens in edit mode as the default. When I click the "Update" button, niether the updated or updating events fire. I have put breakpoints on each and it just passes over them. What am I missing or not understanding? Thank you for any advice or assistance.

Here is the code.
C#
protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            ddl = this.DetailsView1.Rows[0].Cells[1].FindControl("ddlfunctions") as DropDownList;
            function = ddl.SelectedItem.ToString();

            ddlseg = this.DetailsView1.Rows[1].Cells[1].FindControl("ddlSegment") as DropDownList;
            segment = ddlseg.SelectedItem.ToString();
        }

ASP.NET
<asp:DetailsView ID="DetailsView1" runat="server" onmodechanging="DetailsView1_ModeChanging" OnItemUpdated="DetailsView1_ItemUpdated"
          DefaultMode="Edit" CssClass="panelStyle" OnDataBound="DetailsView1_DataBound" CausesValidation="false" ></DetailsView>

Also, I am not sure the code in the event is accurate, I just know its not getting reached and the detailsview is only there in portion to show the pertinent items.
Posted
Updated 11-Sep-12 5:38am
v3
Comments
Himanshu Yadav 11-Sep-12 13:28pm    
Ctrl+Alt+P use this short cut to attach to process.once you attach to process it will start debuging
Richard C Bishop 11-Sep-12 13:51pm    
Debugging is not the issue, the deteailsview onitemupdated event is not firing when I hit the update button.

1 solution

1. Have you defined the SQLDataSource for the dataview to use?
2. If Yes, Does the SQLDatasource defined has the Updatecommand with Update Parameters?
3. Does the DataView is bound to the SQLDatasource?
4. Do you the Inbuilt Update button or a Customized button?
5. If customized button have you called the DetailsView1.UpdateItem(false) method?
 
Share this answer
 
Comments
Richard C Bishop 13-Sep-12 10:12am    
Thank you, I was using a custom button and calling the UpdateItem method made it fire. I still need to figure out the code to update the database with the correct values though.

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