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

[Solved] Synchronize RadGridView active row with DomainDatasource CurrentItem

1 Answer 187 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
cachuoi
Top achievements
Rank 1
cachuoi asked on 02 Oct 2009, 05:17 AM
Hi,
I use RadGridView in Telerik Q3 Beta 2009.3.916 binding to DomainDatasource and I have a problem. When I change selected item (by click or up/down arrow), DomainDatasource.DataView.CurrentItem doesn't change. Also, when I use method to move next/previous item of DomainDatasource, SelectedItem (or active item) of RadGridView doesn't change.
If I use GridView standard, SelectedItem and CurrentItem of DomainDatasource always synchronized. How can I implement to get this feature?
Thanks!

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 02 Oct 2009, 06:00 AM
Hello cachuoi,

We are aware of this problem and will fix it as soon as possible.
Currently RadGridView is not synchronizing its CurrentItem/SelectedItem properties with the CollectionView that RadGridView is bound to.

For the time being you can use the following workaround:

public MainPage()     
{     
    InitializeComponent();     
    
    this.DomainDataSource.DataView.CurrentChanged += new EventHandler(DataView_CurrentChanged);     
    this.gridView2.SelectionChanged += new EventHandler<SelectionChangeEventArgs>(gridView2_SelectionChanged);     
}     
    
void gridView2_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)     
{     
    this.DomainDataSource.DataView.MoveCurrentTo(this.gridView2.CurrentItem);     
}     
    
void DataView_CurrentChanged(object sender, EventArgs e)     
{     
    this.gridView2.SelectedItem = this.DomainDataSource.DataView.CurrentItem;     
    this.gridView2.CurrentItem = this.DomainDataSource.DataView.CurrentItem;     
}   

Luckily the DomainDataSource provides CurrentChanged event that can be used to synchronize SelectedItem and CurrentItem of the grid. Similarly you can use the SelectionChanged event of RadGridView to updated the CurrentItem of the Domain DataSource.

All the best,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
cachuoi
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or