I click "Edit" & the in-line editor opens with two new links: "Update" "Cancel" after an edit I click "Update" it updates fine but does not close the in-line editor. To close the editor I have to click "Cancel".
I've checked the cs code, the aspx code, and the properties but I don't see anything different. Yet, on one grid the in-line editor closes after "Update" is clicked and on the other it does not.
What am I missing?
Thanks,
Phil
ASPxGridView - The inline edit form is not closed when the Update button is pressed
Answers
Phil,
The difference between the ASPxClientGridView.CancelEdit and ASPxClientGridView.UpdateEdit methods is that the first method simply switches the grid to browser mode without sending values from the grid's inputs to the datasource.
When the Update button is pressed, the grid's code collects all values from the editors (e.NewValues collection) and passes them to the datasource.
Usually, when users perform custom updating, they get values from editors manually, store them in the database and then close the edit form with the ASPxClientGridView.CancelEdit method.
Thanks,
Vest
I have the same issue with Batch Edit Mode.
After I call 'grid.UpdateEdit()' it update correctly the database, in effect if I call 'grid.Refresh()' I can see the new value and the grid seems to exit from edit mode.
Hello,
I have created a separate ticket on your behalf to process your inquiry more effectively:
T105383: ASPxGridView / Batch Editing - The EditForm is not closed
Please refer to it for further correspondence.
Hi Phil,
Obviously something is wrong but it is very difficult to determine the cause of this problem. To help you resolve this problem we need a sample project showing this issue. Please post it here and we will do our best to help you.
Thanks,
Plato
The top grid, ID="gridRegions" does NOT close the inline editor when "Update" is clicked.
The bottom grid, ID="gridViewCaseNumbers" does.
Hello Philip,
Thank you for your code. On the client side, I see that your RowClick event switches the grid to Edit Mode. I assume that when you press the Update button, you send two parallel callbacks: a callback to Update a row, and a callback to start row editing.
I think that it is better to replace default command buttons with custom command buttons, so you can try to raise only required events. For example, if a user updates a row, by clicking the Update button, you can check the ASPxClientGridView.CustomButtonClick event. If it is raised before the RowClick event, you can define some flag. Checking the flag, you can decide not to switch the grid to Edit Mode.
Thanks,
Vest
Hi Vest,
Thanks for the info however, I am sorry I left that in. I added it recently & was testing it but the problem is present with or without the RowClick event in the code.
As for custom vs default you'll notice that the two grids both use default buttons and still, one works the other does not.
If it make you happier please remove the RowClick event, the grid still does not work.
Phil
Hello Philip,
Thank you for the clarification. I see that my solution did not help you. Unfortunately, I could not find why it does not work incorrectly, and I need to debug it.
Since attached files belong to a part of the solution, they are incomplete and I cannot execute them. Could you please create a small demo using your approach with some temporary datasource and send it to me? I will debug it on my side and let you know what is wrong.
As a template, please use the ASPxGridView - How to update data with the enter key / by selecting another row example and modify it according to your scenario.
Thanks,
Vest
Well, in making an example I found the problem, which often happens.
Why you couldn't find the problem I don't know because once you see it your hit yourself for missing it.
One line in the
protected void gridRegions_RowUpdating
method was missing, it was:
gridRegions.CancelEdit(); // This line closes the line Editor.
That's it. Without this line the line editor stays open, with it the line editor closes down after the edit is done. This line was in the other "_RowUpdating" method and as I went through eliminating all the code not needed to demo the problem I saw this line & took a look in my code because I did not remember it and sure enough, it was missing.
Score: DevExpress 0 pk 9
Better luck next time.
Hello Philip,
I am glad that you have found a solution. As you know it is hard to debug the application only by using source code. I could not execute it and thus I asked you for a sample.
It would be helpful for us to process the report effectively, if you clean your code a bit, or make a small sample, because each feature is already tested and it works in a wide range of applications, including our examples.
Thanks,
Vest
Vest,
I don't believe any example from me is needed. Simply use any grid that uses, onrowupdating="…" and uses the in-line-editor, <EditButton Visible="True" />
then in the method used to handle the onrowupdating="gridName_RowUpdating" either add or remove the line I found worked:
gridName.CancelEdit(); // This line closes the line Editor.
That is all I did to make it work, the editor closed when "Update" was clicked (had this line), or not, the in-line editor stayed open after the update was completed (this line was commented out or missing.)
Phil
Phil,
I apologize that I cannot find a solution by reading your code. I am glad that the issue is solved, and you shared your fix with us.
Feel free to close the report, if you do not need my further assistance on this topic.
Thanks,
Vest
What part of the following don't you understand???
--------------------------------------------------
One line in the
protected void gridRegions_RowUpdating
method was missing, it was:
gridRegions.CancelEdit(); // This line closes the line Editor.
--------------------------------------------------
Can you not find the method, "protected void gridRegions_RowUpdating" in my code? I find it in the zip file cs file just fine. The lines are:
protected void gridRegions_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
{
e.Cancel = true;
object key = e.Keys[0];
just put the missing line after the object key line as in:
protected void gridRegions_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
{
e.Cancel = true;
object key = e.Keys[0];
gridRegions.CancelEdit(); // This line closes the line Editor.
and then it works & closes the in-line editor.
Isn't this in some documentation some place???
I looked up "CancelEdit()" & found this:
http://www.devexpress.com/Support/Center/e/E1522.aspx
It's supposed to cancel the edit but it also closes the in-line editor & I guess that if all your changes have been saved then when is "cancels" it does not wipe out changes made in the table it just closes the in-line editor. I think that example would have confused me since I didn't want to cancel the edit just the editor & perhaps that's what's confusing you?