private void BindData() { UseMatBLL bll = null; DataPage dp = new DataPage(); UseMatBill condition = new UseMatBill(); try { bll = BLLFactory.CreateBLL <UseMatBLL>(); condition.BatchNumber = this.BatchNumber.Text; PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <UseMatBill> list = dp.Result as List <UseMatBill>; this.GvList.DataSource = list; this.GvList.DataBind(); for (int i = 0; i < this.GvList.Rows.Count; i++) { string pid = null; if (this.GvList.DataKeys[i]["PID"] != null) { pid = this.GvList.DataKeys[i]["PID"].ToString(); string viewClick = string.Format("return view('{0}');", pid); (this.GvList.Rows[i].Cells[6].FindControl("LinkView") as LinkButton).Attributes.Add("onclick", viewClick); (this.GvList.Rows[i].Cells[6].FindControl("LinkView") as LinkButton).Text = "查看"; (this.GvList.Rows[i].Cells[7].FindControl("LinkBuild") as LinkButton).Visible = false; } else { (this.GvList.Rows[i].Cells[6].FindControl("LinkView") as LinkButton).Enabled = false; } } PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }