RadGridView CellEditTemplate and CellValidating

4 posts, 0 answers
  1. Raymond
    Raymond avatar
    65 posts
    Member since:
    Oct 2013

    Posted 24 Nov 2014 Link to this post

    I am using a GridView with a CellEditTemplate to display a DatePicker with the date selection mode set to "Month".  However this then meant that the CellValidation's event argument e.NewValue didn't contain the value selected by the user; rather it contained a minimum date value (#12:00:00am#).

    After sifting through numerous articles searching for a resolution to this problem - the majority in this forum which referred to creating custom validation procedures and deriving new column types and another explaining the Validation Lifecycle that gave absolutely no information on cell validating using editing templates (and none that gave any examples) - I finally came across this article http://www.telerik.com/forums/custom-template-in-grid that explained you simply had to use "e.EditingElement" to gain access to the editor used in the cell.

    I am raising this thread in the hope that other users will be able to quickly locate the solution to this problem and not waste hours of their time.
  2. Boris
    Admin
    Boris avatar
    276 posts

    Posted 25 Nov 2014 Link to this post

    Hello Raymond,

    Thank you for sharing your solution. 

    In addition, you can check the PreparingCellForEdit event which will allows you to access the default editor and initialize some of its properties if needed. Another possible approach is to create a custom column like in the Create Custom DateTimePicker Column article.

    On a side note I noticed that the link to the blog post in the mentioned forum thread was broken, so here is the working one: http://blogs.telerik.com/xamlteam/posts/09-10-27/how-to-validate-data-with-sl-wpf-radgridview-part-i-validating-on-property-cell-level-via-data-annotations.aspx

    Regards,
    Boris
    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.

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

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

    Thanks a ton Raymond. 

    I was also cracking my head and googling on the same issue. You are right there is no mention of "e.EditingElement" anywhere. I feel Telerik should automatically grab the underlying editor value and bind it to the e.NewValue if you are using EditTemplate. This should help a lot of developers trying to figure out whats really happening.

    Thanks again
    Kiran
  4. Boris
    Admin
    Boris avatar
    276 posts

    Posted 12 Dec 2014 Link to this post

    Hello Kiran,

    Actually for the existence of the EditingElement property you can check the PreparingCellForEditPreparedCellForEdit and CellEditEnded events in our documentation.

    In addition, thank you for your suggestion, it sounds like a nice idea and we will discuss it with our development team. 

    Regards,
    Boris
    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