Bug Report B134036
Visible to All Users

ASPxGridView - CellEditorInitialize and ParseValue events are fired multiple times during an Update

created 16 years ago

Gridview's CellEditorInitialize() and ParseValue() are called multiple times (for the same field) while processing the update after editing/inserting a row.

  1. It makes no sense at all to fire CellEditorInitialize() when doing an update after editing. The editor form is closing and the editors will not be seen again! Furthermore, this event is fired twice on each field before the update completes.
  2. The ParseValue() event fires THREE times for each field during the update. This is not only grossly inefficient but is highly destructive. Since the purpose of the event is most likely to alter the values coming back from the editors, possibly based on those very editied values ( e.Value = DoSomethingWith(e.Value) ) the result is that the desired editor value is destroyed by being operated on multiple times.
    Steps to Reproduce:
    Launch the attached test project
  3. Set up a SQLDatasource and connect it to your favorite table, set up for selects, updates and inserts.
  4. Drop a GridView on the page, connect it to the datasource, enable it for edits and inserts, take all other default settings, let it load up all the colunms from the datasource.
  5. Add even handlers for CellEditorInitialize() and ParseValue().
  6. Place breakpoints on these two event handlers.
  7. Run the page, edit a row, and click Update. Observe when and how many times the events are fired.
    Actual Results:
    CellEditorInitialize() fires twice for each field during the update.
    ParseValue() fires three times for each field during the update.
    In each case, the even fires once for each field in the correct sequence before repeating this sequence.
    CellEditorInitialize (2:55:14): CategoryName
    CellEditorInitialize (2:55:14): Description
    CellEditorInitialize (2:55:21): CategoryName
    CellEditorInitialize (2:55:21): Description
    ParseValue (2:55:21): CategoryName=Meat/Poultry
    ParseValue (2:55:21): Description=Prepared meats
    CellEditorInitialize (2:55:21): CategoryName
    CellEditorInitialize (2:55:21): Description
    ParseValue (2:55:21): CategoryName=Meat/Poultry
    ParseValue (2:55:21): Description=Prepared meats
    ParseValue (2:55:21): CategoryName=Meat/Poultry
    ParseValue (2:55:21): Description=Prepared meats
    Expected Results:
    CellEditorInitialize() should fire once per field on the start of the edit, and never fire on an update. ParseValue should fire exactly once for each field.
Comments (2)
DevExpress Support Team 16 years ago
    Serge (DevExpress Support) 16 years ago

      IMPORTANT NOTE: Before the changes made to resolve this issue the Grid reset its hierarchy before calling its OnCallback server-side event. As a result, you can refer to its elements and templates in this event handler without re-binding. Now, the Grid resets its hierarchy and it's necessary to explicitly apply data changes to controls by calling the DataBind() method. This may cause some issues in the existing applications. For example, check this report: populate combobox on fly in gridview
      Thanks,
      Serge

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.