Showing inserted row

2 posts, 0 answers
  1. Michael
    Michael avatar
    19 posts
    Member since:
    May 2015

    Posted 07 Dec 2016 Link to this post

    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
               

  2. Stefan
    Admin
    Stefan avatar
    1073 posts

    Posted 12 Dec 2016 Link to this post

    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.
Back to Top