asp.net 如何实现 带分页功 能 的合并单元格显示呀
效果如下:|—————————————————————————————|
|                             |       收入一              |
|       项目名称               ——————————————|
|                             |       收入二              |  
|—————————————————————————————|
|                             |       收入11              |
|       项目名称2              ——————————————|
|                             |       收入222             |  
|—————————————————————————————|
 首页  上一页  下一页  尾页

解决方案 »

  1.   

    给你个实例代码吧,你自己修改一下:
    1.把aspx前台中GridView中的AllowPaging设置为true,并设置每页的分页条数。
    2.点击闪电图标,找到PageIndexChanging事件并双击,添加代码,例如:GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            Bind();
    }后台Bind()函数如下:        SqlConnection thisConnection = new SqlConnection("Server=.;UID=sa;PWD=;DataBase=Graduation_Project");
            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.CommandText = @"
                                      select 
                                        *
                                          from 
                                        Book
                                       ";
            thisConnection.Open();
            sqlCommand.Connection = thisConnection;
            SqlDataAdapter sda=new SqlDataAdapter(sqlCommand);
            DataTable dt=new DataTable();
            sda.Fill(dt);
            GridView1.DataSource = dt;
            GridView1.DataBind(); 
            thisConnection.Close();或者为:        SqlConnection thisConnection = new SqlConnection("Server=.;UID=sa;PWD=;DataBase=Graduation_Project");
            string sql = @"
                                      select 
                                        *
                                          from 
                                        Borrow
                                       ";
            thisConnection.Open();
            SqlDataAdapter sda=new SqlDataAdapter(sql,thisConnection);
            DataSet dataSet = new DataSet();
            sda.Fill(dataSet, "Borrow");
            GridView1.DataSource = dataSet.Tables["Borrow"].DefaultView;
            GridView1.DataBind(); 
            thisConnection.Close();
      

  2.   

    DataList能够比较方便的实现你要的效果
      

  3.   

    兄弟啊,真是冤枉,我辛辛苦苦那么多代码就给两分,ls的一句话就给17??GridView是Datalist的进化版啊给你推荐好的反而分数少了,冤死我了