List<T> paging asp.net
Posted
by
user1397978
on Stack Overflow
See other posts from Stack Overflow
or by user1397978
Published on 2012-06-23T09:13:11Z
Indexed on
2012/06/23
9:15 UTC
Read the original article
Hit count: 182
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
© Stack Overflow or respective owner