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

Weird behavior on RadGridView when reactivating MDI child form

0 Answers 7 Views
GridView
This is a migrated thread and some comments may be shown as answers.
John Pedersen
Top achievements
Rank 1
John Pedersen asked on 29 Aug 2018, 09:00 AM

I'm not sure if someone will help me with this, considering the version. We are using radcontrols for winforms Q1 2009 SP1 (2009.1.9.414). 

I have a MDI Parent, and several mdi children. One MDI Child form with a RadGridView on it. The form works fine, and performs as expected. I use events like CellBeginEdit and CellEndEdit to make changes to the database. The gridview is bound to a BindingList<myCustomClass>. When I edit directly in the grid I update to database on CellEndEdit the entire object. something like this:

myCustomClass objToUpdate = (myCustomClass)RadGridView1.Rows[e.RowIndex].DataBoundItem;

Debug.WriteLine("id: " + objToUpdate.Id);

Debug.WriteLine("Priority: " + objToUpdate.Priority);

db.UpdateCustomClass(objToUpdate); 

 

However here is the problem:
If I do one update, change to another MDI Child form, and change back to the form in question, the objects are not updated correct. I can see in the debug that the Id property is correct, but the priority (Int32) have the old value. Since Priority is Int32, I can change with both keyboard and numeric up/down. But if I change priority using numeric up/down editor it works. If I change priority from 1 to 2 with keyboard and press Enter, the value does not change, but if I try to edit again, the numeric up/down have value 2...

If I just open the form and select a row, change back and forth, and do an update, everything works. It is just if I make a change to the datasource before changin forms the problem occurs. 

I have tried to deselect currentRow when form1 is deactivated, so that when I come back I have to select the row again, but does not work. 

clearing bindinglist og populating grid again does not work either. I have to restart the form.

 

 

Any help greatly appreciated.. :-| 

No answers yet. Maybe you can help?

Tags
GridView
Asked by
John Pedersen
Top achievements
Rank 1
Share this question
or