在控件的ItemCreated事件中写if (e.Item.ItemType == ListItemType.Pager)
{
    e.Item.Cells[0].Controls.Add(new LiteralControl("  总共" + yourGrid.PageCount + "页"));
}

解决方案 »

  1.   

    <tr>
              <td width="539" height="25"  valign="middle" class="bottom">
      当前第<font color=red><%=dg.CurrentPageIndex+1%></font>页|
      共<font color=red><%=dg.PageCount%></font>页|每页<font color=red><%=dg.pagesize%></font>笔
    </td>
            </tr><asp:datagrid id="dg"></datagrid>
      

  2.   

    需要自己写  前面是连接你相应的数据库
    CurrentPage   当前页
    TotalPages 总页数CurrentPage.InnerHtml=(dgThreads.CurrentPageIndex+1).ToString();
    TotalPages.InnerHtml=(dgThreads.PageCount).ToString();