This is a migrated thread and some comments may be shown as answers.

in CellValidating, e.NewValue is null, on add

7 Answers 189 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 04 Jan 2012, 08:15 PM
I have a RadGridView, with a CellValidating event handler.

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

Sort by
0
Maya
Telerik team
answered on 05 Jan 2012, 08:21 AM
Hello Jeff,

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 ?  

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Jeff
Top achievements
Rank 1
answered on 05 Jan 2012, 04:49 PM
In your sample, e.NewValue is set to the value in the new cell during an add.

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.
0
Maya
Telerik team
answered on 05 Jan 2012, 05:49 PM
Hello Jeff,

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. 

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Kiran
Top achievements
Rank 1
answered on 09 Dec 2014, 07:43 PM
Hi Jeff,
Did you get the problem resolved? I'm also having the same issue. The NewValue is always 0 (int bound column).

Thanks
0
Maya
Telerik team
answered on 10 Dec 2014, 02:45 PM
Hi Kiran,

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.

 
0
Kiran
Top achievements
Rank 1
answered on 10 Dec 2014, 03:15 PM
Thank yo Maya for the reply.

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
0
Maya
Telerik team
answered on 12 Dec 2014, 08:32 AM
Hi 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.

 
Tags
GridView
Asked by
Jeff
Top achievements
Rank 1
Answers by
Maya
Telerik team
Jeff
Top achievements
Rank 1
Kiran
Top achievements
Rank 1
Share this question
or