This question is locked. New answers and comments are not allowed.
Hello guys, I just can't get the grid loaded with the correct data. Without the datapager the grid refreshes correctly when I remove a row from the datasource but with the pager it simple moves the row to the end of the grid.
I'm using SL3 + RIA Services + Entity Framework in my application.
Here's the scenario:
I have a Users table, one column is boolean and it represents if the user is active or not. I have a query to get all the active users.
My grid has the normal columns (name, lastname, etc) and also a template column with a buttom that let set an user as "Inactive" (IsActive equals false).
When I click on the button the expected behavior is to set the IsActive column to false. The query is executed when the DataSource refreshes (refresh interval is every 10 secs) and the record is not included anymore since I'm just gettting the active users.
On the click event of this button I'm doing something like this:
| var gridViewRow = ((Button)sender).ParentOfType<GridViewRow>(); |
| if (gridViewRow != null) |
| { |
| User userRow = (User)gridViewRow.DataContext; |
| var error = (from usr in UserDataSource.DomainContext.Entities.GetEntityList<User>() |
| where usr.UserId == userRow.UserId |
| select usr).Single<User>(); |
| ((User)error).IsFixed = true; |
| UserDataSource.DomainContext.SubmitChanges(); |
| } |
The Xaml looks like this:
| <riaControls:DomainDataSource x:Name="UserDataSource" |
| DomainContext="{StaticResource UserContext}" |
| AutoLoad="True" |
| QueryName="GetActiveUsers" |
| LoadingData="UserDataSource_LoadingData" |
| LoadedData="UserDataSource_LoadedData" RefreshInterval="00:00:10"> |
| <telerikGridView:RadGridView x:Name="grdUsers" AutoGenerateColumns="False" Height="Auto" |
| ShowGroupPanel="False" DataLoadMode="Synchronous" ItemsSource="{Binding Data, ElementName=UserDataSource}"> |
| <!-- COLUMNS --> |
| </telerikGridView:RadGridView> |
| <data:DataPager x:Name="dtPager" Source="{Binding Data, ElementName=UserDataSource}" PageSize="10"> |
| </data:DataPager> |
Important Note: I'm setting e.MergeOption = MergeOption.OverwriteCurrentValues; in the UserDataSource_LoadingData
I've tried setting the pagesize and loadsize properties for the DomainDataSource. Also my query has an order by clause. And I've also added a SortDescriptor for my UserDataSource.
As you can see I've tried almost everything advised in other forums, however I can't get the grid to work as I want to.
I appreciate all the help you can provide me. Thanks in advance.