在datagrid事件里有翻页事件。估计你没写。

解决方案 »

  1.   

    AllowCustomPaging="False",再在DataGrid_PageIndexChanged事件中书写下面代码:
     DataGrid.CurrentPageIndex = e.NewPageIndex;
     BindGrid();//用作datagrid的数据绑定用
      

  2.   

    按照icecock的方法写了:运行报错:
    AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID DataGrid1 when AllowPaging is set to true and the selected datasource does not implement ICollection. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID DataGrid1 when AllowPaging is set to true and the selected datasource does not implement ICollection.
      

  3.   

    Line 118: myConnection.Open();
    Line 119: DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
    Line 120: DataGrid1.DataBind();
    Line 121: }
    Line 122: protected string formaturl(object strArgument)
     Source File: d:\inetpub\wwwroot\webhandphone\addgoods.aspx.cs    Line: 120 
      

  4.   

    我说明一下,我的页面是根据孟子E章的从数据库中读取图片到datagrid中显示的例子生成的
    http://dotnet.aspx.cc/ShowDetail.aspx?id=ECD9AE16-8FF0-4A1C-9B9F-5E8B641CB1B1在我的datagrid中绑定显示了图片的
      

  5.   

    你还少个触发分页的事件,在PageIndexChanged事件中写:
    private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
    {
    SqlDataAdapter da=new SqlDataAdapter("select * from gj_lb_zd",con);
    DataSet ds = new DataSet();
    da.Fill(ds,"gj_lb_zd");
    DataGrid1.DataSource=ds.Tables["gj_lb_zd"].DefaultView;
    DataGrid1.CurrentPageIndex=e.NewPageIndex;
    DataGrid1.DataBind();
    }
      

  6.   

    还是不成功,在页的html中有:
    <asp:TemplateColumn HeaderText="图片">
    <HeaderStyle Wrap="False" HorizontalAlign="Center" VerticalAlign="Middle"></HeaderStyle>
    <ItemStyle Wrap="False" HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
    <ItemTemplate>
    <asp:Image id=Image1 runat="server" Height=30 Width=30 ImageUrl='<%# formaturl(DataBinder.Eval(Container.DataItem,"id")) %>'>
    </asp:Image>
    </ItemTemplate>
    </asp:TemplateColumn>即绑定的是一个图片,在这种情况下,要如何生成分页呢????????
      

  7.   

    http://blog.csdn.net/zhzuo/category/13485.aspx
      

  8.   

    孟子E章的文章,(C#)版  读取数据库图片显示在DataGrid中后,如何分页???
    孟子E章作品出处:
    http://dotnet.aspx.cc/ShowDetail.aspx?id=ECD9AE16-8FF0-4A1C-9B9F-5E8B641CB1B1