简单,在DataGrid的ItemCreated事件里:
ListItemType elemType = e.Item.ItemType;
if (elemType == ListItemType.Pager) 
{
// The pager as a whole has the following layout:
//
// <TR><TD colspan=X> ... links ... </TD></TR> 
//
// Item points to <TR>. The code below moves to <TD>.
TableCell pager = (TableCell) e.Item.Controls[0]; // Loop through the pager buttons skipping over blanks
// (Blanks are treated as LiteralControl(s)
for (int i=0; i<pager.Controls.Count; i+=2) 
{
Object o = pager.Controls[i];
if (o is LinkButton) 
{
LinkButton h = (LinkButton) o;
h.Text = "[ " + h.Text + " ]"; 
}
else
{
Label l = (Label) o;
l.Text = "Page " + l.Text; 
}
}

解决方案 »

  1.   

    Build a Variety of Custom Controls Based on the DataGrid Control 
    http://msdn.microsoft.com/msdnmag/issues/01/10/cutting/default.aspx
      

  2.   

    上面这是在页码1,2,3,4上加上[],你可以改一下:
    h.Text = "[ " + h.Text + " ]";  改成:h.Text = "Page: " + h.Text ; 
      

  3.   

    你也可以用这个分页控件,有更多选项可以设置:
    http://www.webdiyer.com
      

  4.   

    你可以写一个通用的修改页脚的代码
    比如下面
    public void DateGridPage(System.Web.UI.WebControls.DataGrid dg, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    int flage = 0;if (e.Item.ItemType == ListItemType.Pager)
    {
    TableCell c = e.Item.Cells[0];

    foreach (Control ctr in c.Controls)
    {
    if (ctr is LinkButton)
    {
    if ( flage == 0 && ((LinkButton)ctr).Text=="...")
    {
    ((LinkButton)ctr).Text = "[ 上一页 ]";
    flage = 1;
    }
    else if( flage == 1 && ((LinkButton)ctr).Text=="...")
    {
    ((LinkButton)ctr).Text = "[ 下一页 ]";}
    else
    {
    ((LinkButton)ctr).Text = "[ " + ((LinkButton)ctr).Text + " ]";
    flage = 1;
    }
    }
    else if (ctr is Label)
    {
    ((Label)ctr).Text = "<font color=red>- " + ((Label)ctr).Text + " -</font>";
    flage = 1;
    }
    }
    }

    if (e.Item.ItemType == ListItemType.Footer)
    {
    //构造页脚注释
    int originCells = e.Item.Cells.Count;
    for (int i = 1; i < originCells; i++)
    {
    e.Item.Cells.RemoveAt(1);
    }
    e.Item.Cells[0].ColumnSpan = originCells;

    StringBuilder sb = new StringBuilder();
    sb.Append("共 <font color=blue>");
    sb.Append(dg.VirtualItemCount);
    sb.Append("</font> 条,分 <font color=blue>");
    sb.Append(dg.PageCount);
    sb.Append("</font> 页,每页 <font color=blue>");
    sb.Append(dg.PageSize);
    sb.Append("</font> 条。");e.Item.Cells[0].Controls.Add(new LiteralControl(sb.ToString())); }
    }