试试这个,我很久以前在谷歌搜索时发现了它。
protected void grdProductStock_DataBound(object sender, EventArgs e) {
if (grdProductStock!= null)
{
//Showing Search Result Count
//Get Top Pager Row from a gridview
GridViewRow row = grdProductStock.TopPagerRow;
if (row != null)
{
//Create one Cell for adding in my current paging strip
TableCell infocell = new TableCell();
infocell.Text = ” Page ” + (grdProductStock.PageIndex + 1).ToString() + ” of ” +grdProductStock.PageCount.ToString() +“(” + table.Rows.Count.ToString() + ” Records)”;
//Getting table which shows PagingStrip
Table tbl = (Table)row.Cells[0].Controls[0];
//Will Find table
tbl.Rows[0].Cells.Add(infocell);
}
}
}
这里的表是您的数据源,即 dataset.tables[0].rows.count。datatable.rows.count 等