DataTable dt = new DataTable();
dt.Columns.Add("JobNum");//工号
dt.Columns.Add("PSNNAME");//姓名
dt.Columns.Add("CORP_NAME");//公司名
dt.Columns.Add("field");//软件名
DataRow tr = dt.NewRow();
tr["JobNum"] = txtJobNum.Text;//工号
tr["PSNNAME"] = dsInfo.Tables[0].Rows[0]["PSNNAME"].ToString();//姓名
tr["CORP_NAME"] = dsInfo.Tables[0].Rows[0]["CORP_NAME"].ToString();//公司名
tr["field"] = field;//软件名
dt.Rows.Add(tr);
DataView dv = dt.DefaultView;
if (ViewState["SortExpression"] != null && ViewState["SortDirection"] != null)
{
dv.Sort = ViewState["SortExpression"].ToString() + " " + ViewState["SortDirection"].ToString();
}
int page_Size = System.Convert.ToInt32(this.ddlPageRecords.SelectedItem.Value);
gridView.PageSize = page_Size;
gridView.DataSource = dv;
gridView.DataBind();
//分页
int rows_Count =dt.Rows.Count;
//int page_Size = gridView.PageSize;
int page_Count = gridView.PageCount;
int page_Current = gridView.PageIndex + 1;
lblRowsCount.Text = rows_Count.ToString();
lblPageCount.Text = page_Count.ToString();
lblCurrentPage.Text = page_Current.ToString();