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

RadGridView CellEditTemplate and CellValidating

3 Answers 242 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 24 Nov 2014, 11:31 PM
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.

3 Answers, 1 is accepted

Sort by
0
Boris
Telerik team
answered on 25 Nov 2014, 12:24 PM
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.

 
0
Kiran
Top achievements
Rank 1
answered on 09 Dec 2014, 08:09 PM
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
0
Boris
Telerik team
answered on 12 Dec 2014, 09:36 AM
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.

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