I am doing paging in a Listview
with Entity Framework and I'm stuck when passing startindex
and maxrows
after clicking the next/prev button
This is my code
private List<WorkItem> Data(int startindex, int maxrows)
{
return (from x in ss.WorkItem
select x).OrderBy(p => p.WorkItemID).Skip(startindex).Take(maxrows).ToList();
}
protected void lvWorkItems_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
{
this.DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
lvWorkItems.DataSource = Data(e.StartRowIndex,e.MaximumRows);
lvWorkItems.DataBind();
}
My problem is how to pass startindex
and maxrows
when I click on next/Previous button.
Please help