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

DomainDataSource: New Item not displayed in GridView

2 Answers 78 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Wolfgang Kamir
Top achievements
Rank 1
Wolfgang Kamir asked on 09 Nov 2010, 12:53 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Yavor Georgiev
Telerik team
answered on 09 Nov 2010, 01:07 PM
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
0
Wolfgang Kamir
Top achievements
Rank 1
answered on 15 Nov 2010, 04:53 PM
Thanks a lot, Yavor Georgiev!

Works great.

Kind regards,
Wolfgang
Tags
GridView
Asked by
Wolfgang Kamir
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Wolfgang Kamir
Top achievements
Rank 1
Share this question
or