Current filter:
                                You should refresh the page.

                                This example is obsolete. Refer to the T806194 - ASP.NET WebForms Spreadsheet Editor - Early Access Preview v19.2 help topic instead.

                                I want to display my business object that has a byte array property as an Excel document allowing users to modify the content and save it to the database. ASPxSpreadsheet is an appropriate component for this task, but how to implement a Web Property Editor based on it?

                                Unlike regular ASP.NET editors and controls, ASPxSpreadsheet is a front-end to a document service similar to Google Docs that will be running on your web site if you add this component to your application. Because of this, a property editor based on the ASPxSpreadsheet component has some specific features.

                                1. If a user opens a document, the next user who opens the same document will see the actual document content even if the first user did not save it to the database.

                                2. The Refresh action does not discard changes made in the document. The actual document state is stored in the service, and the content stored in the database is used as backup.

                                3. The Save action updates the content stored in the database. If the user closed a document without clicking the Save action, changes made to the document will be stored on the service and another user can save them to the database.

                                The property editor demonstrated in this example works with properties of a specific type - SpreadsheetDocument, and does not write any changes to a property. Instead, it modifies referenced objects directly. The SpreadsheetExample.Module\BusinessObjects\Report.cs (SpreadsheetExample.Module\BusinessObjects\Report.vb) file contains a class that has a property of the SpreadsheetDocument type. Note that this property is considered a part of the persistent object (that is why it has the Aggregated attribute) and automatically initialized with the value within the AfterConstruction method.

                                The editor implementation is simple. Refer to the SpreadsheetExample\SpreadsheetExample.Module.Web\Editors\SpreadsheetEditor.cs (SpreadsheetExample\SpreadsheetExample.Module.Web\Editors\SpreadsheetEditor.vb) file for details. It uses the ASPxSpreadsheet.Open and ASPxSpreadsheet.SaveCopy methods to synchronize the opened document with the database. Documents are identified by the persistent object's key property. This allows opening a separate document for each record in the database.