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);
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);