用GridView设计固定行数的入库单报表

在仓库管理系统中经常打印固定格式的入库单和出库单。如下图所示:

用GridView设计固定行数的入库单报表

其中,要求行数(假如10行)要固定,也就是说没有数据的要求补空行。其实用GridView很容易就实现了,其中空行的处理是通过datatable实现的。

 

用GridView设计固定行数的入库单报表用GridView设计固定行数的入库单报表Code
            //绑订点验单明细
            string sql = "select * from wz_v_dydmx where dydid='" + this.Request.QueryString["dydid"].ToString().Trim()+"'";
            DataSet ds 
= wzgl.DAL.DBAccess.ExecuteDataSet(sql);
            
//增加空行
            int intRows = ds.Tables[0].Rows.Count;
            
for (int index = 0; index < 10 - intRows; index++)//假如固定行数是10行
            {
                DataRow row 
= ds.Tables[0].NewRow();
                ds.Tables[
0].Rows.Add(row);
            }
            
this.gv_dydmx.DataSource = ds;
            
this.gv_dydmx.DataBind();    

转载于:https://www.cnblogs.com/shajianheng/archive/2008/12/31/1366321.html