我在网格中更新项目后调用了方法:
public void GridView1_UpdateItem(int noteId)
{
Notes itemToEdit = context.Notes.FirstOrDefault(x => x.NoteId == noteId);
Notes originalItem = context.Notes.FirstOrDefault(x => x.NoteId == noteId);
TryUpdateModel(itemToEdit); //it should update only object itemToEdit
}
为什么TryUpdateModel(itemToEdit)
还要更新对象 originalItem?对象 originalItem 具有来自表单的新值,但它应该具有旧值。