in CellValidating, e.NewValue is null, on add

8 posts, 0 answers
  1. Jeff
    Jeff avatar
    100 posts
    Member since:
    Apr 2008

    Posted 04 Jan 2012 Link to this post

    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?

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 05 Jan 2012 Link to this post

    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 >>

  3. Jeff
    Jeff avatar
    100 posts
    Member since:
    Apr 2008

    Posted 05 Jan 2012 Link to this post

    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.
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 05 Jan 2012 Link to this post

    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 >>

  5. Kiran
    Kiran avatar
    17 posts
    Member since:
    Aug 2012

    Posted 09 Dec 2014 in reply to Maya Link to this post

    Hi Jeff,
    Did you get the problem resolved? I'm also having the same issue. The NewValue is always 0 (int bound column).

    Thanks
  6. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 10 Dec 2014 Link to this post

    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.

     
  7. Kiran
    Kiran avatar
    17 posts
    Member since:
    Aug 2012

    Posted 10 Dec 2014 in reply to Maya Link to this post

    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
  8. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 12 Dec 2014 Link to this post

    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.

     
Back to Top