Adding Pagination using data pager to data grid Silverlight 3
-
Wednesday, August 26, 2009 1:59 AM
Hi,
I am new to silverlight 3 and trying to attach pagination using data pager. i have written the following code but its not working.. i am calling the data from WCF
Service
<StackPanel x:Name="LayoutRoot" Background="White">
<data:DataGrid x:Name="TempDataGrid" AutoGenerateColumns="False" >
<data:DataGrid.Columns>
<data:DataGridTextColumn Header="Name" Binding="{Binding Name}" />
<data:DataGridTextColumn Header="Score" Binding="{Binding Score}" />
<data:DataGridTextColumn Header="Status" Binding="{Binding Status}" />
</data:DataGrid.Columns>
</data:DataGrid>
<data:DataPager x:Name="TempDataGridDataGridPager" HorizontalAlignment="Left" VerticalAlignment="Top" DisplayMode="FirstLastPreviousNext" PageSize="5"
Source="{Binding Path=ItemSource,ElementName=TempDataGridDataGrid}">
</data:DataPager>
</StackPanel>and in the code behind i am getting the whole list of 100 records in e.result
TempDataGrid.ItemsSource = e.Result;
All Replies
-
Wednesday, August 26, 2009 3:01 AM
Hello,
see this link
http://silverlight.net/learn/tutorials/sqldatagrid.aspx
Mark as answer if it helpful to u.........
Thanks,
Pratixa
-
Wednesday, August 26, 2009 3:12 AM
Hi,
Check this out. This may help you out-
http://msdn.microsoft.com/en-us/magazine/dd695920.aspx
http://stackoverflow.com/questions/1143155/domaindatasource-datapager-with-silverlight-3-datagrid-net-ria-servicesThanks,
Pravin
"Please mark as answered, if this answers your question"
-
Wednesday, August 26, 2009 3:20 AM
Hello,
see this link also..... It is using the RIA Controls
Mark as answer if it helpful to u....
Thanks,
Pratixa
-
Wednesday, August 26, 2009 4:17 AM
its really good -
Wednesday, August 26, 2009 5:52 AM
Hello,
Thanks to all for your replies.. But Why is it necessary to use RIA services controls to implement pagination.
Can't I do pagination without RIA services and just using simply silverlight controls.
Thanks,
Kalashnikov
-
Wednesday, August 26, 2009 6:20 AM
Hello,
I think you ahve problem in your code
<data:DataPager x:Name="TempDataGridDataGridPager" HorizontalAlignment="Left" VerticalAlignment="Top" DisplayMode="FirstLastPreviousNext" PageSize="5"
Source="{Binding Path=ItemSource,ElementName=TempDataGridDataGrid}">
</data:DataPager>You have taken the - ElementName=TempDataGridDataGrid, but u have to take the
ElementName=TempDataGridMark as Answer if it helpful to u...
Thanks,
Pratixa
-
Wednesday, August 26, 2009 6:32 AM
Hi,
Just solved this problem. Check this post and It may help you out-
http://silverlight.net/forums/t/122632.aspx
Thanks,
Pravin
"Please mark as answered, if this answers your question"
-
Wednesday, August 26, 2009 6:57 AM
Hello,
Found a simple solution for doing it. We can bind the list obtained from the WCF service to the PagedCollectionView and use it in the ItemsSource of the data grid and Source of the Data Pager.
here is the code,
<data:DataGrid x:Name="TempDataGrid" /> <data:DataPager x:Name="TempDataGridPager" Source="{Binding Path=ItemsSource,ElementName=TempDataGrid}" PageSize="5"/>
and code behind
PagedCollectionView tempListView = new PagedCollectionView(e.Result);
TempDataGrid.ItemsSource = tempListView ;where e.Result is the list of objects returned from the WCF service .
Thanks everyone for your help !!
Regards,
Kalashnikov
-
Wednesday, August 26, 2009 7:15 AM
Hi,
That's good. Please mark it as answered !!
Thanks,
Pravin
"Please mark it as answered, if this answers your question"
-
Friday, August 28, 2009 1:28 AM
hi
plz ask me How to insert a row and edit it a datagrid in ria service in silverlight 3
i try to add a row with a child window but i want to click add button to add a new row in datagrid
plz ask in ria service without binding plz
-
Friday, August 28, 2009 1:30 AM
hi
plz ask me How to insert a row and edit it a datagrid in ria service in silverlight 3
i try to add a row with a child window but i want to click add button to add a new row in datagrid
plz ask in ria service without binding plz
-
Wednesday, February 10, 2010 4:07 PM
Dumb questions but......I can't seem to find any interface or classes with PagedCollectionView
How can I use it?
:(
-
Wednesday, February 10, 2010 10:33 PM
neverming...I had to add reference to the project. For some reason, using "using System.Windows.Data" wasn't enough.

-
Wednesday, March 24, 2010 8:06 AM
Guys,
I have a DataPager under a grid, that it is not linked with the grid (I will get records at the SQL when user click to next page of the DataPager).
The total of registers returned of SQL is always 10(because pagination of SQL the total of records returned each time is 10). Therefore ItemSource of the grid have always only 10 lines..
I get the total of records with "Select Count...)
How to put total of pages at DataPager?
Thanks in advance.
Loas
-
Friday, November 12, 2010 2:24 PM
Loas, even I am stuck with the same problem. Any solution is appreciated.
-
Thursday, December 29, 2011 2:57 AM
Thanks you so much.
-
Thursday, December 29, 2011 4:15 AM
It's simple. You just need to know the total records count. Get this from your datapager and minus eg :
Protected Sub ListView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DataBound
Dim item As ListViewDataItem
For Each item In ListView1.ItemsDim lbl As Label = CType(item.FindControl("Label1"), Label)
lbl.Text = (myDataPager.TotalRowCount /10)+"" //total of pages
Next -
Sunday, July 29, 2012 4:14 PM

