可以让DataGrid帮定的 DataTable加一个空行

解决方案 »

  1.   

    不想改数据库啊 
    客户端脚本 怎么写啊!  net_lover(孟子E章) 
      

  2.   

    在DATATABLE中架空行并与分页匹配:
    private ICollection CreateDataSource() 
    {
    String connectionString ="server=(local)\\NetSDK;database=Northwind;Integrated Security=SSPI";
    SqlConnection myConnection = new SqlConnection(connectionString);
    String sql = "select FirstName, LastName from Employees";
    SqlDataAdapter empAdapter = new SqlDataAdapter(sql,myConnection);
    DataSet ds = new DataSet();
    empAdapter.Fill(ds,"Employees");
    int ps = empGrid.PageSize;
    int te = ds.Tables["Employees"].Rows.Count;
    int f=te/ps;
    DataTable dt=ds.Tables["Employees"];
    for(int i=0;i<ps-(te-Int32.Parse(f.ToString())*ps);i++){
    DataRow r = dt.NewRow();
    dt.Rows.InsertAt(r,totalEmployees);
    }
    totalEmployees = dt.Rows.Count;
    DataView dv = new DataView(dt);
    return dv;
    }http://218.84.107.5/n.aspx