It receives a GridVIewCellValidatingEventArgs argument, named e.
e has a field, newValue.
When I'm editing a cell, whether on an existing row or on a new one, the CellValidating event fires, and my event handler catches it.
When I'm editing a cell in an existing row, I can access the object being edited via e.newValue.
When I'm editing a cell in a new row, e.newValue is null.
Is this supposed to happen? If so, what should I use instead of e.newValue?
7 Answers, 1 is accepted
I have tried to reproduce the issue you reported, but still without any success. Could you take a look at the sample attached and let me know whether I am missing something ? Can you reproduce the same behavior on it ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
That's not what is happening in mine. I've probably got something wierd going on in the binding, somewhere. I expect I'll be able to chase it down.
At this point, my biggest problem with this stuff is unfamiliarity. I'm not sure what is supposed to be happening. I've spent days, before, chasing down what looked like a bug only to find out it was intended behavior, and I was simply using the wrong facility to try to accomplish things.
You've made it clear what should be happening. Thanks.
I am glad that the sample is of any help. Do let me know in case you need any further assistance or if you can reproduce the behavior from your application in the sample project.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Did you get the problem resolved? I'm also having the same issue. The NewValue is always 0 (int bound column).
Thanks
Actually, we did not find any bug here. Will it be possible to check out the project attached and verify whether you get the behavior on it ? Which version are you working with ?
Regards,
Maya
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
The attached sample works fine. I noticed that Im using Edit data templates. In that case, the values is set to 0. I later figured out from other user in this forum that we need to look for e.EditingElement to gain access to the underlying control. I feel Telerik grid should automatically grab that value and attach it to e.NewValue if possible.
Thanks again
Kiran
Actually, we cannot predict what is the editing element and which property should be used for setting its value to e.NewValue. What if there is a custom control with multiple TextBox-es inside, which property should be use for the purpose ?
And since such scenarios cannot be generalized and united under the same conditions, it is up to your customers to decide what that value is and how to handle the case.
Regards,
Maya
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.