Toggle menu
876
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Help talk:Contents

Discussion page of Help:Contents
Revision as of 07:45, 22 December 2008 by Catglobe (talk | contribs) (New page: <source lang="csharp" line="1"><br>private DataTable GetPageData(int pageSize, int pageIndex)<br>{<br>DataTable source = this.SourceTable;<br>int startIndex = (pageIndex - 1) * pageS...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<source lang="csharp" line="1">
private DataTable GetPageData(int pageSize, int pageIndex)
{
DataTable source = this.SourceTable;
int startIndex = (pageIndex - 1) * pageSize;
int endIndex;
if (startIndex + pageSize > source.Rows.Count)
endIndex = source.Rows.Count;
else
endIndex = startIndex + pageSize;

DataTable pageData = new DataTable();

for (int i = 0; i < source.Columns.Count; i++)
{
pageData.Columns.Add(source.Columns[i].ColumnName, source.Columns[i].DataType);
}
for (int i = startIndex; i < endIndex; i++)
{
object[] newrow = new object[source.Columns.Count];
pageData.Rows.Add(source.Rows[i].ItemArray);
}

return pageData;
}

</source>