Use the wizard to create grid view and generate the insert, update, and delete sql statements with parameters. Having those insert, update, and delete statements in the code automatically allow for the saving of data by clicking the update button. Use the following code example as a guide. For clearer reference, I performed this example based on Murach pg 409.
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
DataKeyNames="ProductID" DataSourceID="SqlDataSource1">
<Columns>
<asp:boundField dataField="ProductID" HeaderText="ProductID"
SortExpression="ProductID" ReadOnly="True">
</asp:boundfield>
<asp:boundField dataField="Name" HeaderText="Name" SortExpression="Name"/>
<asp:boundField dataField="ShortDescription" HeaderText="ShortDescription" SortExpression="ShortDescription"/>
<asp:BoundField DataField="LongDescription" HeaderText="LongDescription"
SortExpression="LongDescription" />
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID"
SortExpression="CategoryID" />
<asp:BoundField DataField="ImageFile" HeaderText="ImageFile"
SortExpression="ImageFile" />
<asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice"
SortExpression="UnitPrice" />
<asp:BoundField DataField="OnHand" HeaderText="OnHand"
SortExpression="OnHand" />
<asp:CommandField ButtonType="Button" ShowEditButton="true" CausesValidation="false" />
<asp:CommandField ButtonType="Button" ShowDeleteButton="true" CausesValidation="false" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConn %>"
DeleteCommand="DELETE FROM [Products] WHERE [ProductID] = @ProductID"
InsertCommand="INSERT INTO [Products] ([ProductID], [Name], [ShortDescription], [LongDescription], [CategoryID], [ImageFile], [UnitPrice], [OnHand]) VALUES (@ProductID, @Name, @ShortDescription, @LongDescription, @CategoryID, @ImageFile, @UnitPrice, @OnHand)"
SelectCommand="SELECT * FROM [Products]"
UpdateCommand="UPDATE [Products] SET [Name] = @Name, [ShortDescription] = @ShortDescription, [LongDescription] = @LongDescription, [CategoryID] = @CategoryID, [ImageFile] = @ImageFile, [UnitPrice] = @UnitPrice, [OnHand] = @OnHand WHERE [ProductID] = @ProductID">
<DeleteParameters>
<asp:Parameter Name="ProductID" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="ShortDescription" Type="String" />
<asp:Parameter Name="LongDescription" Type="String" />
<asp:Parameter Name="CategoryID" Type="String" />
<asp:Parameter Name="ImageFile" Type="String" />
<asp:Parameter Name="UnitPrice" Type="Decimal" />
<asp:Parameter Name="OnHand" Type="Int32" />
<asp:Parameter Name="ProductID" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ProductID" Type="String" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="ShortDescription" Type="String" />
<asp:Parameter Name="LongDescription" Type="String" />
<asp:Parameter Name="CategoryID" Type="String" />
<asp:Parameter Name="ImageFile" Type="String" />
<asp:Parameter Name="UnitPrice" Type="Decimal" />
<asp:Parameter Name="OnHand" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>