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

Value not changing in cells when using controls inside the cell

1 Answer 43 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Victor Manuel Gonzalez Tellez
Top achievements
Rank 1
Victor Manuel Gonzalez Tellez asked on 23 Apr 2010, 02:04 AM
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> 


1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 27 Apr 2010, 10:37 AM
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.
Tags
GridView
Asked by
Victor Manuel Gonzalez Tellez
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or