The ASPxGridView does not natively support multi-row editing. It is recommended to either use the single-row inline editing by setting the AllowEdit property of the ListView model to True in the Model Editor, or edit objects in a DetailView. The multi-row editing functionality is rarely required, but since our customers usually experience difficulties implementing it, I decided to create this example.
There are several examples on how to implement this functionality in the ASPxGridView without XAF. From my point of view, the How to perform ASPxGridView instant updating using different editors in the DataItem template example is the most appropriate for XAF, because:
- this approach can be easily implemented using runtime code
- we already use DataItem templates to show data in grid cells.
All functionality is implemented in a single controller - the MultiRowEditingController. It performs the following operations:
1. Creates an ASPxCallback control and adds it to a page. This control is used to send callbacks from client-side editors used in grid cells.
2. Replaces the default DataItemTemplate with a custom one (EditItemTemplate). The custom template is required to show editors for the user input in grid cells. This template is based on the DataItemTemplate class used in XAF by default. The only difference is that controls from this template are always in the Edit mode.
3. Assigns the client-side script that performs a callback when the value is changed to the editors added to grid cells via the custom DataItemTemplate. This is done in the editor's Init event handler, because at this moment, the NamingContainer that contains the key of the bound object is available.
4. Handles the callback sent from the client side and changes the value of a corresponding object's property.
I recommend that you review the following help topics for additional information:
Access Grid Control Properties
ASPxGridView.Templates Property
See Also:
How to use custom ASPxGridView template in a Web XAF application
Example Comments
Added By: Yuriy Konytskyy at: 6/3/2013 6:44:39 AM
I doesn't work in v12.2.10
Added By: Anatol (DevExpress Support) at: 7/1/2013 7:19:13 AMI have updated the example. Please see implementation details for version 13.1.
Added By: Sandro Welter (Intelligix) at: 7/5/2013 6:02:00 PMI'm getting the error below.
The error occurred:
Type: NullReferenceException
Message: Object reference not set to an instance of an object.
Data: 0 entries
Stack trace:
The NullReferenceException issue is solved.