protected void gvPrice_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblState = e.Row.FindControl("lblState") as Label; Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; Button btnEdit = e.Row.FindControl("btnEdit") as Button; if (!Convert.IsDBNull(gvPrice.DataKeys[e.Row.RowIndex].Value)) { int emid = Convert.ToInt32(Session["EmployeeId"]); //绑定子GridView GridView gv = e.Row.FindControl("GridView2") as GridView; int SaleId = Convert.ToInt32(gvPrice.DataKeys[e.Row.RowIndex].Value); OfferPriceInfo pc = new OfferPriceInfo(SaleId); int mainid = Convert.ToInt32(pc.MainOfferPriceId); DataTable dt = OfferPriceInfo.getOfferPriceListOfEmployee2(emid, mainid); if (dt.Rows.Count == 0) { dt.Rows.Add(dt.NewRow()); UI.BindCtrl(dt.DefaultView, gv, AspNetPager2); gv.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gv, AspNetPager2); } //button控制 if (pc.IsApply == 1) { btnSubmit.Enabled = false; if (pc.IsNewCreate == 1)//审批未通过,修正。 { btnEdit.Enabled = true; } else//默认IsNewCreate==0,已申请,编辑按钮不可用。 { btnEdit.Enabled = false; } } if (pc.IsApply2 == 0) { lblState.Text = "总经办:待审"; } else if (pc.IsApply2 == 1) { if (pc.IsOver2 == 1) { lblState.Text = "总经办:通过"; } else { lblState.Text = "总经办:修正"; } } } if (e.Row.RowType == DataControlRowType.DataRow) { //鼠标移动到每项时颜色交替效果 e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //设置悬浮鼠标指针形状为"小手" e.Row.Attributes["style"] = "Cursor:hand"; } } }