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

Showing inserted row

1 Answer 44 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 07 Dec 2016, 05:02 PM

hi

 

I have an EntityFramework table as my ItemsSource:

Ent = new Data.xEntities();
RadViewGrid.ItemsSource = Ent.Table;

If I insert a row from the "new row" row in the grid it disappears an does not show in the grid. Even if I Rebind() the grid.

If I

Ent.SaveChanges();
RgvUsers.Rebind();

it works. But I would like to save all changes at once via a Save Button.

How can I make the inserted row show in the grid without committing it back to the db? Thanks.

Regards,
Michael
           

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 12 Dec 2016, 11:14 AM
Hi Michael,

The control does not provide an out-of-the-box approach for meeting such requirement. A possible solution for it, would be to use an in-memory collection that will serve as a proxy between the UI and the database.  By doing so, you will be able to insert the newly added items in the database at later state, but still be able to populate and edit them in the UI. For example, if you utilize an ObservableCollection as a source collection of RadGridView, you can subscribe to its CollectionChanged event and implement your insertion logic within the event handler.

Would such approach satisfy your needs?

Regards,
Stefan X1
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
GridView
Asked by
Michael
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or