This example is based on the E3983: GridView - How to edit in memory data source example.
It illustrates how to implement row copy / clone functionality similar to the ASP.NET WebForms solution illustrated in the online Grid Columns - Custom Buttons demo.
Here are the main implementation details:
- Specify the GridViewSettings.CustomActionRouteValues.Action property - a method for custom callbacks routine;
- Add a new Custom Button;
- Handle the client-side ASPxClientGridView.CustomButtonClick event;
- Get the clicked row's keyValue via the client-side ASPxClientGridView.GetRowKey method. Pass the e.visibleIndex property as a parameter;
- Store the retrieved row's keyValue;
- Perform a custom grid callback via the client-side ASPxClientGridView.PerformCallback method;
- Handle the client-side ASPxClientGridView.BeginCallback event. If the custom callback is currently processing (e.command equals "CUSTOMCALLBACK"), populate the e.customArgs item with the stored keyValue. See the Passing Values to Controller Action Through Callbacks help article to learn more on how to deal with this option;
- Handle GridViewSettings.CustomActionRouteValues.Action. Pass the stored keyValue to the PartialView via the ViewData;
In the PartialView:
- Handle the GridViewSettings.BeforeGetCallbackResult event. If there is an item in the ViewData, start editing a new row via the MVCxGridView.AddNewRow method;
- Handle the GridViewSettings.InitNewRow event. If there is an item in the ViewData, copy row values from the original row to the new one.
Question Comments
Added By: Satendra Jindal at: 7/17/2016 11:50:34 PM At least you should have given demo. Added By: Mike (DevExpress Support) at: 7/18/2016 1:00:59 AM
Hello,
I've created a separate ticket on your behalf (T404305: How to download and play E4643 example). It has been placed in our processing queue and will be answered shortly.