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

e.OldData vs e.NewData in CellEditEnded

3 Answers 229 Views
GridView
This is a migrated thread and some comments may be shown as answers.
joe castle
Top achievements
Rank 1
joe castle asked on 27 Jan 2010, 06:04 PM
Hi,

I try to check if the user changed any value in edit mode or not. The problem is that e.OldData != e.NewData even if the user just entered edit mode and came out. For numeric column (with DataFormatString = "{0:N}") the grid shows "0.0", but in edit it shows "0" so the values are not equal. For date column OldData is "" and NewData is null, just because I clicked F2.

Can this be avoided? Or is there a better way to check for changed cell values?

Thank you,
joe

3 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 28 Jan 2010, 03:19 PM
Hello joe castle,

Thank you for pointing this out.
Indeed this is a little bit confusing. This issue is already fixed and will be available with the next latest internal build (Friday 29 January). Please try it and let me know if you have further related questions.

P.S. I've updated your Telerik points accordingly.

Regards,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Brian Thomas
Top achievements
Rank 1
answered on 15 Apr 2010, 05:55 PM
I am also trying to determine if the cell has changed and I'm trying to compare the new and old value properties but the new value property is always null. I am using the 2010 Q1 release and my column is using the CellEditTemplate.

My Grid is based off a IList of custom objects. What should I look for to get this to work? Below is the XAML and code I'm trying to get to work.

<telerik:GridViewDataColumn Header="Line Code" UniqueName="PCWNO"
                                <telerik:GridViewDataColumn.CellEditTemplate> 
                                    <DataTemplate> 
                                        <telerik:RadComboBox  
                                            Text="{Binding Path=PCWNO, Mode=TwoWay}"  
                                            IsEditable="True"  
                                            ItemsSource="{Binding Source={StaticResource odpLineCodes}}"  
                                            DisplayMemberPath="T_Line_Code"  
                                            TextSearch.TextPath="T_Line_Code"  
                                            TextSearch.Text="T_Line_Code"
                                        </telerik:RadComboBox> 
                                    </DataTemplate> 
                                </telerik:GridViewDataColumn.CellEditTemplate> 
                            </telerik:GridViewDataColumn> 

private void grdProdData_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e) 
        { 
            if (e.NewData != null
                System.Diagnostics.Trace.WriteLine("CellEditEnded" + " - " + e.NewData.ToString()); 
        } 
           
0
Nedyalko Nikolov
Telerik team
answered on 19 Apr 2010, 12:17 PM
Hi Brian Thomas,

Indeed when CellEditTemplate is used there is no way to get proper value for GridViewCellEditEndedEventArgs.NewData property at run time. You can use e.EditingElement property which will return the actual editing element (in your case RadComboBox).

Kind regards,
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
joe castle
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Brian Thomas
Top achievements
Rank 1
Share this question
or