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

e.Cell.DataContext null during CellEditEnded event

4 Answers 33 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nathaniel
Top achievements
Rank 1
Nathaniel asked on 28 Nov 2011, 07:48 PM
I just upgraded to the newest release and I'm geting an exception in this code now.  This code has been working fine with the previuous relases for months.  e.Cell.DataContext is now null.   Did I miss a breaking change?


 private void Grid_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e) {

            MyObject  myObj = e.Cell.DataContext as MyObject;

          ..
          .

           ..
           
        }

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 29 Nov 2011, 07:46 AM
Hello Nathaniel,

Generally, the DataContext of the cell will be the underlying data item. I have tested the code-snippet you gave and everything works properly without throwing any exceptions. Would you clarify a bit more whether there is something else that needs to be done in order to get the same behavior as you ? 
 

Best wishes,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Nathaniel
Top achievements
Rank 1
answered on 29 Nov 2011, 01:23 PM
The casting of the datacontext to myObj does not raise an exception, but when i try to access a property of myObj it raises the exception because the object is null.


0
Nathaniel
Top achievements
Rank 1
answered on 05 Dec 2011, 01:46 PM
Maya,

Do i need to provide more info or is this a forgotten issue.  This  problem is preventing me from upgrading to the latest release. Should I stop using the CellEditEnded event?

0
Maya
Telerik team
answered on 05 Dec 2011, 03:56 PM
Hi Nathaniel,

I am sending you the sample project I used for testing the case. Could you take a look at it and let me know whether you can reproduce the behavior on it ?
 

Best wishes,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Nathaniel
Top achievements
Rank 1
Answers by
Maya
Telerik team
Nathaniel
Top achievements
Rank 1
Share this question
or