Getting the exception object not set to an instance of an object. Nothing gets saved to the grid view. The run-time continues to display the object reference exception. This is not a nullreferenceexception error.
using (var context = new CAREntities1())
{
var args = sender as GridViewRowEditEndedEventArgs;
CAR.ASSET localasset = args.EditedItem as CAR.ASSET;
if (args.EditAction ==
Telerik.Windows.Controls.GridView.GridViewEditAction.Commit)
if (args.EditOperationType ==
Telerik.Windows.Controls.GridView.GridViewEditOperationType.Edit)
var entity = context.ASSETS.Find(localasset.BARCODE);
if (entity == null)
return;
context.Entry(entity).CurrentValues.SetValues(localasset);
context.SaveChanges();///saves to the database
Getting the error object not set to an instance of an object. I am trying to edit a record within a Grid-view.