Set detailsView currentmode after an update

Posted on 2010-01-08
Last Modified: 2013-11-07
I'm trying to figure out how to set the mode of a detailsView after I perform an update.  Right now everything works as far as clicking edit, altering a value, clicking update, and then seeing the new value but the detailsView is still in edit mode.  I've tried several different things but I just can't get it to revert back.  Please see attached code.


Protected Sub dvProjectDetails_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewCommandEventArgs) Handles dvProjectDetails.ItemCommand

    If e.CommandName = "Update" Then

        Dim projectDetailsAdapter As New ProjectDetailsAdapter


            projectDetailsAdapter.updateProjectDetails(sProjectID, sProjectTypeCode, sUserName)

        Catch exError As Exception

            lblErrorMessage.Text = "Error updating project details: " & exError.Message

            lblErrorMessage.Visible = True


            projectDetailsAdapter = Nothing

        End Try

    End If

End Sub




    EmptyDataText="no records found"




        <asp:CommandField ShowSelectButton="true" ControlStyle-CssClass="btn" ButtonType="Button" ItemStyle-HorizontalAlign="center" />

        <asp:BoundField DataField="ProjectID" HeaderStyle-Width="0%" HeaderText="Project ID" SortExpression="ProjectID" ItemStyle-HorizontalAlign="center" visible="false" />



Open in new window

Question by:stretch73
    LVL 8

    Accepted Solution

    First, make sure the Detailsview default mode isn't in edit or insert - that will keep it in that mode permanently.

    Second, try using this after your update:

    Author Closing Comment

    Got me there, thanks.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now