DomainDataSource: New Item not displayed in GridView

3 posts, 1 answers
  1. Wolfgang Kamir
    Wolfgang Kamir avatar
    80 posts
    Member since:
    Jul 2006

    Posted 09 Nov 2010 Link to this post

    Hi dear forum members,

    I am using a telerik:GridView with DomainDataSource and telerik:DataPager.

    GridView.ItemsSource and RadDataPager.Source are set to

    "{
    Binding Data, ElementName=TeachersDomainDataSource}"


    Everything works fine: Loading Data, Paging... Now when I add a new Item to my ServiceContext like this:

    private

     

    void AddTeacher(object o)

     

     

    {

     

     

      var newTeacher = new Teacher();

      Context.Teachers.Add(newTeacher);

      SelectedTeacher = newTeacher;

      SelectedTeacher.BeginEdit();

    }

     



    I would like to have it already displayed in the DataGrid (as empty line or probably with defaults later on). Except it is not displayed automatically and I'm not sure why - I would have expected the INotifyCollectionChange to kick in here....

    What additional step would I need to take, to have the newly added Item dispay in my GridView?

    Thanks for any hint!

    Kind regards,
    Wolfgang


  2. Answer
    Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 09 Nov 2010 Link to this post

    Hello Wolfgang Kamir,

     RadGridView does not bind to the EntitySet directly, but to the DomainDataSourceView exposed by the Data and DataView properties. The problem is that the DomainDataSourceView does not subscribe to the CollectionChanged event of its underlying EntitySet, so that when you add an item there, it does not show up in the View, and then in the RadGridView. You should work with the DataView property of the DomainDataSource control directly so that the changes are propagated to the RadGridView.

    Sincerely yours,
    Yavor Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Wolfgang Kamir
    Wolfgang Kamir avatar
    80 posts
    Member since:
    Jul 2006

    Posted 15 Nov 2010 Link to this post

    Thanks a lot, Yavor Georgiev!

    Works great.

    Kind regards,
    Wolfgang
Back to Top