List<T> paging asp.net
- by user1397978
Using a three-tier architecture, I have a list of objects
List<object> careerList = new List<object>();
ModuleDTO module = new ModuleDTO();
careerList = module.getDegreeCodeByQualification(qualificationCode);
which I then add to a gridview like so:
gridViewMaster.DataSource = careerList;
gridViewMaster.DataBind();
What I'd like to do is then enable paging on the gridview. My gridview so far is:
<asp:GridView ID="gridViewMaster" runat="server"
AutoGenerateColumns="False" GridLines="None"
BorderWidth="1px" CellPadding="2" DataKeyNames="Grouping"
ForeColor="Black"
onrowdatabound="gridViewMaster_RowDataBound" CssClass="mGrid" PagerStyle-CssClass="pgr"
AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="gridView_PageIndexChanging"
AllowPaging="True" >
Is it possible to do enable paging on a list's without having to change that list to a Datatable or Dataview? If there is a way, this would help a lot.
So far my events are as follows:
protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gridViewMaster.PageIndex = e.NewPageIndex;
List<object> careerList = new List<object>();
ModuleDTO module = new ModuleDTO();
careerList = module.getDegreeCodeByQualification(qualificationCode);
ModalProgress.Show();
System.Threading.Thread.Sleep(1000);
JobPanel.Visible = true;
gridViewMaster.DataSource = careerList.Distinct();
gridViewMaster.DataBind();
}
Someone PLEASE HELP ME!!! Thank you