Hello,in my WebDataGrid I want to let the user add new records. The first column is the key column and the values entered into this field have to be unique. So I wanted to use the CellEditing_ExitedEditMode event.
Here I want to validate the entered value and if the entered value is already in that grid I tried to use "eventArgs.set_cancel(true)". I know this property is available in eventArgs of the CellEditing_EnteringEditMode event and also the method to set that value.
see screenshot2
Unfortunately a similar property and the method are not available in the CellEditing_ExitedEditMode as you can see in screenshot 2
Why is that property and method not available? Has this a special reason? If I can prohibit editing a cell I think it should also be possible to cancel editing. How can I do that now?
Hi martinn,
It turns out you're correct that this behavior does exist, but you are just using the wrong event. We have four events four editing: entering, entered, exiting, and exited. The -ed events happen after the cell has already entered or exited edit mode. It really is just a notification. In order to cancel the event, you need to handle the -ing events. The method on the event args will be available in the exitingEditMode event. Let us know if you need any other help.
regards,David Young
OK, may be that I use the wrong event. Now I'm trying to use the ..-exiting event. But here is the problem that I can not get the value of the cell. May be that I'm wrong again. Please let me know how I do that correctly.
I expected that a similar code can also be used in the -exiting function. But I get no value from the cell. Also using "get_text" does not give a result. How can I figure out what the user has typed in at this time?
Ok, I found the value in the eventArgs and so I'm able to deside to accept that value or not. An other "strange" behavior is this: In my former used (-Exited) procedure I found the value and could display a single message eg. ("wrong value") as I wrote in the example above. But now if I use the -extiting event it seems to be fired two times because I get two "alerts". I did not change anything else. Only using the suggested method. Any further suggestions?
Hi,Okay, I'm taking a look over what you have here. I will send you an update tomorrow as to what I discover.Sincerely,TroyDeveloper Support Engineer
Hi,
I wanted to update you on this case. I am parsing through the code of the sample and I will get back to you as soon as I have further information. Presently, I'm having to solve a sql connection string issue to get the sample up and running.
Sincerely,TroyDeveloper Support Engineer
Hi Martinn,
Do you have any additonal questions regarding this matter? If so, please let me know how I can help.
SincerelyTroyDeveloper Support Engineer
Okay, I've taken a look at your sample and tested a few times. The outcome is that at the CellEditing_ExitingEditMode event, I only get the alert once (provided I change value for ProductName to not = "Test"). Otherwise the event/message will keep firing and the focus is held until the change is made.
As a note, for this test I used IE8.
Please let me know if I can be of further assistance.
Sincerely,TroyDeveloper Support Enginner