Value not changing in cells when using controls inside the cell

2 posts, 0 answers
  1. Victor Manuel Gonzalez Tellez
    Victor Manuel Gonzalez Tellez avatar
    7 posts
    Member since:
    Jan 2010

    Posted 22 Apr 2010 Link to this post

    Hi good day. I would like a little help with an issue we're facing. We have a grid view, in which I have cells with RadTimePicker in the Edit Template. The problem is that when I enter a value (like 9) and after I pressed tab, the value gets erased. The only way it works it's when the user presses Enter. I realized that the event on CellEditEnded, gets call once with TAB, but NewValue and OldValue are null both. In the case of Enter, that event gets called twice, the first one is the same, NewValue and OldValue are nulls, and the second time I get NewValue = null and OldValue= 9 (the value entered), In my model I have to ignore the null, and that is why the value gets perserved, otherwise, even that way would not work. Why is this happening and how can I solve it. Thanks in advance.

    My XAML:

     <!--Shift IN--> 
                                        <telerikGridView:GridViewDataColumn Header="Shift-In" UniqueName="ShiftInValidator" DataMemberBinding="{Binding ShiftInValidator}" DataFormatString="{}{0:c}" Width=".115*"
                                            <telerikGridView:GridViewDataColumn.CellTemplate> 
                                                <DataTemplate> 
                                                    <TextBlock Text="{Binding ShiftInValidator}"></TextBlock> 
                                                </DataTemplate> 
                                            </telerikGridView:GridViewDataColumn.CellTemplate> 
                                            <telerikGridView:GridViewDataColumn.CellEditTemplate> 
                                                <DataTemplate> 
                                                    <telerikInput:RadTimePicker SelectedTime="{Binding ShiftInValidator, Mode=TwoWay}" 
                                                                                EndTime="23:0:0" Culture="en-US"/> 
                                                </DataTemplate> 
                                            </telerikGridView:GridViewDataColumn.CellEditTemplate> 
                                        </telerikGridView:GridViewDataColumn> 


  2. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 27 Apr 2010 Link to this post

    Hello Victor Manuel Gonzalez Tellez,

    Indeed NewValue argument of the GridVIewCellEditEndedEventArgs when CellEditTemplate is used is null, since RadGridView cannot get new value from the custom editor (in your case it is RadTimePicker). You can use GridVIewCellEditEndedEventArgs.EditingElement property which gives you the real editor (RadTimePicker) which can help in this scenario.

    I've tried to simulate the issue with Enter key (CellEditEnded is called twice) unfortunately to no avail. Please take a look at the attached test application and let me know what I'm doing wrong.

    Best wishes,
    Nedyalko Nikolov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
Back to Top