How to enable Edit in DetailsView control with custom code to handle the event?

Hi, I'm using VS2013, asp.ent web form and c#
In this DetailsView contorl, it's bind to a database(my code created the columns and the table)  that I created the source is from a class object I retrieve using a web service.  So there is no sql data command that I can configure for it.  
When user click the Update button, how can I make the details view data turn into text box so users can edit the information?  I followed the example here,,  but not sure how to do this part.
Also, how can I get all the modified data to use my code to update via web services.  Is there any indication of what's modified or do I have to update entire fields?
Thank you.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
What have you come up with for the ItemCommand?

asp:DetailsView ID="DetailsView1" runat="server"  
       <asp:BoundField  DataField="IdField" HeaderText="ID" />
       <asp:BoundField  DataField="NameField" HeaderText="Name" />
       <asp:ButtonField CommandName="Add" Text="Add Something" />
       <asp:ButtonField CommandName="Edit" Text="EditSomething" />
       <asp:ButtonField CommandName="Delete" Text="Delete Something" />

in codebehind:

rotected void DetailsView1_ItemCommand(object sender, System.Web.UI.WebControls.DetailsViewCommandEventArgs e)
      switch (e.CommandName) {
            case "Add":

            case "Edit":

            case "Delete":


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lapuccaAuthor Commented:
I only want Edit and Update buttons.  When User hits Edit button i would like the grid to be in Editable form, How to do this?  When user clicks the update mode, I would process the data and then how to change the grid back to read only mode?

Also, to show Edit and a Cancel button when loaded.  And then in Edit mode to show a Update and a Cancel button.  How to switch this?

my cod is about the same as you have it.  
                <asp:TemplateField ShowHeader="False">

                        <asp:Button ID="ButtonUpdate" runat="server" CausesValidation="True"
                            CommandName="Update" Text="Update"  />
                        &nbsp;<asp:Button ID="ButtonCancelUpdate" runat="server" CausesValidation="False"
                            CommandName="Cancel" Text="Cancel" />

                        <asp:Button ID="ButtonEdit" runat="server" CausesValidation="False"
                            CommandName="Edit" Text="Edit" />
                         &nbsp;<asp:Button ID="btnEditCancel" runat="server" CausesValidation="False"
                            CommandName="Cancel" Text="Cancel" />

        protected void dvProtocol_ItemCommand(object sender, DetailsViewCommandEventArgs e)
            DetailsViewRow dvr = dvProtocol.Rows[0];

                case "Update": break;
                case "Edit":
                default: break;


Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.