Hi, I have:
1) Telerik 2013 Q2 SP1;
2) Entity Framework DB (Linq to MySql);
3) Simple table: FirstName(NotNull), LastName(NotNull), Date(Null).
4) Checked for NULL (in MySQL DB and in my Project), i.e. both properties must be NotNull;
5) Made a row validation (it's working, but when I press ESC and then trying to edit another row => the TargetInvocationException fires or smth similar in files such as Cell....cs, Gridview.....cs - I even don't have it);
The question is how to prevent this?
Code:
1) Telerik 2013 Q2 SP1;
2) Entity Framework DB (Linq to MySql);
3) Simple table: FirstName(NotNull), LastName(NotNull), Date(Null).
4) Checked for NULL (in MySQL DB and in my Project), i.e. both properties must be NotNull;
5) Made a row validation (it's working, but when I press ESC and then trying to edit another row => the TargetInvocationException fires or smth similar in files such as Cell....cs, Gridview.....cs - I even don't have it);
The question is how to prevent this?
Code:
private TestDB testDB;
public MainWindow()
{
InitializeComponent();
testDB = new testDBEntities();
radGridView.ItemsSource = testDB.Person;
}
private void radGridView_AddingNewDataItem(object sender, GridViewAddingNewEventArgs e) { e.NewObject = new Person(); testDB.Persons.Add((Person)e.NewObject); } private void radGridView_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e) { if (e.EditAction == GridViewEditAction.Cancel) return; if (e.EditOperationType == GridViewEditOperationType.Edit) { testDB.SaveChanges(); radGridView.Rebind(); } else if (e.EditOperationType == GridViewEditOperationType.Insert) { testDB.SaveChanges(); radGridView.Rebind(); } }