ASPxGridView.UpdateEdit() Method
Saves all the changes made and switches the ASPxGridView to browse mode.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Remarks
End-users can update the edited row by clicking the Update command item.
Example
This example demonstrates how to place multiple grid controls in a callback panel and use a custom button to update the grids simultaneously:
Follow the steps below to update multiple grid controls on a custom button click:
Create the Grid View controls and wrap them in a callback panel.
<dx:ASPxCallbackPanel ID="cp" runat="server" ClientInstanceName="cp" OnCallback="cp_Callback"> <PanelCollection> <dx:PanelContent runat="server" SupportsDisabledAttribute="True"> <dx:ASPxGridView ID="gv1" runat="server" AutoGenerateColumns="False" DataSourceID="ads1" KeyFieldName="CategoryID" OnCommandButtonInitialize="gv_CommandButtonInitialize"> <!-- ... --> </dx:ASPxGridView> <dx:ASPxGridView ID="gv2" runat="server" AutoGenerateColumns="False" DataSourceID="ads2" KeyFieldName="ProductID" OnCommandButtonInitialize="gv_CommandButtonInitialize"> <!-- ... --> </dx:ASPxGridView> </dx:PanelContent> </PanelCollection> </dx:ASPxCallbackPanel>
Handle the grid’s server-side CommandButtonInitialize event. In the handler, hide the grid’s default Update and Cancel command buttons.
Create custom Update and Cancel buttons and set their
AutoPostBack
property tofalse
. In the button’sClick
event handler, call the callback panel’sPerformCallback
method and pass the button type as a parameter.<dx:ASPxButton ID="updateBtn" runat="server" Text="Update" AutoPostBack="false"> <ClientSideEvents Click="OnUpdateClick" /> </dx:ASPxButton> <dx:ASPxButton ID="cancelBtn" runat="server" Text="Cancel" AutoPostBack="false"> <ClientSideEvents Click="OnCancelClick" /> </dx:ASPxButton>
function OnUpdateClick(s, e) { cp.PerformCallback("Update"); } function OnCancelClick(s, e) { cp.PerformCallback("Cancel"); }
Handle the callback panel’s server-side
Callback
event. In the handler, call the grid’sUpdateEdit()
method to update data or CancelEdit() method to discard changes.