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

Server Side Paging

2 Answers 122 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
spam
Top achievements
Rank 1
spam asked on 27 Jan 2011, 07:40 PM
I am using SQL server 2008, Entity Framework 4, SilverLight 4 in my application.

I use a Telerik Grid that dynamically creates columns & pulls data from SQL using LINQ to Entity.

I would like to change it to implement server side paging so that it doesn't pull all the data but rather when it needs to be displayed as we navigate.

Is there any example someone can provide using Telerik grid, Linq to Entity?

Thank you very much,

-Spamproof2010

Below is the code I want to modify when I ad the pager-------------

DataServiceQuery<vwDraw> query = (from o in context.vwDraws
                                              where o.ZoneLevelID == SelectedZoneLevel.ZoneLevelID &&
                                                    o.PubDate >= From &&
                                                    o.PubDate <= To
                                              select o) as DataServiceQuery<vwDraw>;
            Count = query.Count();

            query.BeginExecute(
                (b) =>
                {
                    Application.Current.RootVisual.Dispatcher.BeginInvoke(() =>
                    {
                        DataServiceQuery<vwDraw> D = b.AsyncState as DataServiceQuery<vwDraw>;
                        try
                        {
                            var items = D.EndExecute(b).ToList<vwDraw>();
                            foreach (var item in items)
                            {
                                DrawFields df = new DrawFields();
                                df.ZoneID = item.ZoneId;
                                df.ZoneName = item.ZoneName;
                                df.ZoneGroupID = item.ZoneGroupID;
                                df.ZoneGroupName = item.ZoneGroupName;
                                df.PubDate = item.PubDate;
                                df.Qty = item.Qty;
                                DrawList.Add(df);
                            }
                            View.BusyIndicator.IsBusy = false;
                            View.dg.ItemsSource = null;

                            BindGrid();
                            TotalColumns();
                            if (DrawList.Count == 0)
                            {
                                View.tbSaveStatus.Text = "No draws found!!";
                                DrawList = null;
                                DrawList = new List<DrawFields>();

                                BindGrid();

                            }
                            else
                            {
                                View.tbSaveStatus.Text = string.Empty;
                            }
                        }
                        catch (Exception exp)
                        {
                            throw exp;
                        }
                    });
                },
                query);

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 28 Jan 2011, 05:05 PM
Hello,

Please take a look at this code library.

Kind regards,
Veselin Vasilev
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
spam
Top achievements
Rank 1
answered on 29 Jan 2011, 06:21 PM
Thank you!
Tags
DataPager
Asked by
spam
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
spam
Top achievements
Rank 1
Share this question
or