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

[Solved] URGENT : RadGrid not updating with new data source

1 Answer 198 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.
Shiva
Top achievements
Rank 1
Shiva asked on 02 Aug 2011, 09:17 AM
Dear Community,

We have two silverlight telerik RadGrids on a page.  Here is what we are doing:
  1. We have an observable collection listExecutionHistory and it is being populated from database.
  2. We bind our first grid on a page using above collection.
  3. User can change the data of the grid and thus it will automatically update the observable collection as well because of two way binding.
  4. On click of a button say Next button on this page, we bind another RadGrid on the same page using this same collection. This grid has all read only columns because the sole purpose of this grid is just to show the updates made by the user in the collection via first grid on the same page.
  5. At a time only one grid is visible on the page. That means, when page loads, grid 1 is visible to the user and user can then make change in it. On click of Next button, grid 1 disappears and grid 2 (readonly columns only) become visible so that user can confirm the changes made.

Problem
The problem we are facing is that data of grid 2 is not refreshing everytime we click Next button and it still shows the old data. Following is the code we have on Next button:

 

ctlRollbackConfirmationGrid.ItemsSource = null;
  
ctlRollbackConfirmationGrid.ItemsSource = listExecutionHistory;
  
ctlRollbackConfirmationGrid.Rebind();

Since we are providing a new data source everytime we click Next button, the grid must refresh with new data in the collection but this is not happening. It keeps showing the old data.

Here is the xaml code of Grid 2

<telerik:RadGridView Name="ctlRollbackConfirmationGrid" AutoGenerateColumns="False"  ShowGroupPanel="False" 
                                     HorizontalAlignment="Center" IsFilteringAllowed="False" EnableColumnVirtualization="False" 
                                     EnableRowVirtualization="False" >
                                            <telerik:RadGridView.Columns>
                                                <telerik:GridViewDataColumn UniqueName="CategoryID" DataMemberBinding="{Binding CategoryID}" IsVisible="False"/>
                                                <telerik:GridViewDataColumn Header="Category" Width="80" UniqueName="Category" DataMemberBinding="{Binding CategoryName}" />
                                                <telerik:GridViewDataColumn Header="From Date" Width="75" DataMemberBinding="{Binding FromDate,StringFormat='MM/dd/yyyy'}" >
                                                </telerik:GridViewDataColumn>                                                
                                                <telerik:GridViewDataColumn Header="To Date" Width="75" DataMemberBinding="{Binding ToDate,StringFormat='MM/dd/yyyy'}" >
                                                </telerik:GridViewDataColumn>
                                                <telerik:GridViewDataColumn Header="Counter" Width="70" DataMemberBinding="{Binding CounterTime}" />
                                                <telerik:GridViewDataColumn Header="Discrepancy Check" Width="300" DataMemberBinding="{Binding RollbackType}" />
                                            </telerik:RadGridView.Columns>
                                        </telerik:RadGridView>

:



Could you please urgently help us on this? Let me know if you need more details around the problem.

Regards,
Shiva

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 05 Aug 2011, 11:24 AM
Hi Shiva,

 I have created a sample project following your explanations and code snippets. I have added two GridViews, but for the testing purposes I am keeping them both visible. Unfortunately using the given code I am not able to get the old data in the second GridView.

Please review the example project and if possible change it so that the problematic behavior to be reproduced.  

Let me know how your scenario is different from the one that I have implemented.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
GridView
Asked by
Shiva
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or