使用三层架构,我有一个对象列表
List<object> careerList = new List<object>();
ModuleDTO module = new ModuleDTO();
careerList = module.getDegreeCodeByQualification(qualificationCode);
然后我将其添加到 gridview 中,如下所示:
gridViewMaster.DataSource = careerList;
gridViewMaster.DataBind();
然后我想做的是在gridview上启用分页。到目前为止,我的网格视图是:
<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" >
是否可以在列表上启用分页而不必将该列表更改为 Datatable 或 Dataview?如果有办法,这将有很大帮助。
到目前为止,我的活动如下:
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();
}
有人请帮帮我!!!谢谢