2 <%@ Page Language="C#" %>
3 <%@ Import Namespace="System.Data" %>
6 <script language="C#" runat="server">
8 ICollection CreateDataSource()
10 DataTable dt = new DataTable();
13 dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
14 dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
15 dt.Columns.Add(new DataColumn("DateTimeValue", typeof(string)));
16 dt.Columns.Add(new DataColumn("BoolValue", typeof(bool)));
18 DataView dv = new DataView(dt);
22 void Page_Load(Object sender, EventArgs e)
28 void MyDataGrid_Page(Object sender, DataGridPageChangedEventArgs e)
30 MyDataGrid.CurrentPageIndex = e.NewPageIndex;
36 MyDataGrid.DataSource = CreateDataSource();
37 MyDataGrid.DataBind();
43 lblEnabled.Text = "AllowPaging is " + MyDataGrid.AllowPaging;
44 lblCurrentIndex.Text = "CurrentPageIndex is " + MyDataGrid.CurrentPageIndex;
45 lblPageCount.Text = "PageCount is " + MyDataGrid.PageCount;
46 lblPageSize.Text = "PageSize is " + MyDataGrid.PageSize;
54 <h3>DataGrid Paging Example</h3>
58 <asp:DataGrid id="MyDataGrid" runat="server"
61 OnPageIndexChanged="MyDataGrid_Page"
70 <PagerStyle Mode="NumericPages"
71 HorizontalAlign="Right" />
75 <table bgcolor="#eeeeee" cellpadding="6">
80 <asp:Label id="lblEnabled"
82 <asp:Label id="lblCurrentIndex"
84 <asp:Label id="lblPageCount"
86 <asp:Label id="lblPageSize"