Current filter:
                                You should refresh the page.
                                  • I have a GridView that I'm using EditingMode = EditForm, set at runtime for some columns.
                                    My EditForm is a user control inheriting EditFormUserControl per your examples and containing another user control.
                                    On Update, prior to closing the EditForm I need to insure another process has succeeded.
                                    So, I've hidden the default Update & Cancel buttons and added my own. This all works.
                                    The only question is, in my Update button click event, how do I close the EditForm and update the grid?

                                • Sasha (DevExpress Support) 10.07.2019


                                  There is no simple way to hide EditForm in code. However, you mentioned that you need to perform some custom validation when the Update button is clicked. I suggest that you handle the GridView.ValidateRow event which is raised when the Update button is clicked. Is this solution suitable? If not, please describe your scenario in greater detail and explain why it's necessary to hide the default buttons and what logic should be performed before the Edit Form is closed.

                                  I hope to hear from you soon.

                                • A G 4 10.07.2019

                                  I think you misunderstood. I am not trying to hide the EditForm.
                                  I already have a custom EditForm where I have hidden the default Update and Cancel buttons.
                                  I have provided my own Update button.
                                  This is all done and working.

                                  I only need to know how to close the custom edit form (and therefore update the grid) via my own Update button.

                                • Sasha (DevExpress Support) 10.08.2019


                                  It appears that my previous message was not completely clear - my apologies. What I mean is that the Grid doesn't provide a simple way to perform the default Update operation in code and close the custom Edit Form. That's why, to provide you with the most suitable solution, I need to understand your scenario completely. Would you please clarify the following:
                                  -why is it necessary to hide the default Update and Cancel buttons?
                                  -will the GridView.ValidateRow event be suitable?
                                  -what logic should be performed before the Edit Form is closed?

                                  This information will help us find the most suitable solution.

                                • A G 4 10.08.2019

                                  My custom edit form contains 2 textEdits (TextEdit1, TextEdit2) bound to the edit form's calling gridview (grid1), and an XtraGrid (grid2).
                                  Grid 2 can contain multiple rows and has it's own validations.
                                  After user adds/edits rows in grid2, I'll calculate a max and min value from it's rows and change the editvalue for TextEdit1 and TextEdit2.
                                  User then clicks my custom update button, which should close the EditForm and update grid1.
                                  I can't use the default Update button, because I need to insure that grid2 has been validated and changes saved.
                                  Once I've validated grid 2, what code do I put in my update button's click event to close the EditForm and update grid1?

                                1 Solution

                                Creation Date Importance Sort by


                                Thank you for your detailed description. Now your scenario is completely clear to me. I see several solutions that should help you achieve the required results.

                                1. Since you mentioned that you hide the default Update and Cancel panel, I assume that you are using the">ShowUpdateCancelPanel property which is in effect only when the GridOptionsBehavior.EditingMode property is not set to GridEditingMode.EditForm, i.e. you are using the in-place edit form. If so, you can use the">CloseEditForm() method to close it.
                                2. If it's necessary to close the Edit Form even if it's shown in popup mode, there is no simple out-of-the-box solution. In this case, I suggest that you use the">ValidatingEditor or
                      ">RowUpdated event of the Grid placed into your Edit Form to validate and save changes.
                                3. If the first and second approaches are not suitable, you can create custom Grid and EditFormController descendants and use EditFormController's OnUpdateButtonClick method. I've prepared a small sample that illustrates all three approaches. Please note that since the third approach requires creating a descendant and using undocumented internal methods, we cannot guarantee that it will work correctly in newer versions of our components since these methods can be changed. That's why, I suggest that you use either the first or second approach.

                                I look forward to your results.

                                • A G 4 10.09.2019

                                  Thank you for the sample.
                                  If neglected to mention that I am using GridEditingMode.Editform, so #1 won't work. I hide the default Update/Cancel panel in the gridview.EditFormPrepared event by locating the panel in e.Panel.Controls and setting visible = False.

                                  In #2, I don't see how to close the EditForm.
                                  #3 is out because I can't take the chance of it failing in the future.

                                  I did manage to work something out, though.
                                  In the gridview.ShowingPopupEditForm event, I pass a reference for the gridview and the EditForm itself to my usercontrol (located on the EditForm).
                                  Then in the UpdateButton.Click of my usercontrol, I call the gridview.UpdateCurrentRow() method and editform's Close() method.
                                  This seems to be working fine.
                                  Do you see any problem with it?

                                • Sasha (DevExpress Support) 10.09.2019


                                  As for the second approach - if you decide to try it, you can keep the default Update and Cancel buttons. The idea is that the Grid placed on your Edit Form is validated and its data is saved the moment the default Update button is clicked. So there is no need to create a custom Update button and perform any custom actions when it's clicked.

                                  As for your current approach, I don't see any issues with it. You can slightly simplify it using the FindForm method of your custom EditFormUserControl:

                                  view.UpdateCurrentRow(); FindForm().Close();

                                  Should you have further questions, let me know.

                                • A G 4 10.09.2019

                                  Thank you. I'll stick with my current method and simplify as you suggested using FindForm().

                                • Sasha (DevExpress Support) 10.09.2019

                                  You are always welcome!