protected void gvPrice_RowDataBound(object sender, GridViewRowEventArgs e) { 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"; //申请人、申请时间 Label lblState = e.Row.FindControl("lblState") as Label; Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; Label lblApplyName = e.Row.FindControl("lblApplyName") as Label; Label lblApplyTime = e.Row.FindControl("lblApplyTime") as Label; if (!Convert.IsDBNull(gvPrice.DataKeys[e.Row.RowIndex].Value)) { int SaleId = Convert.ToInt32(gvPrice.DataKeys[e.Row.RowIndex].Value); OfferPriceInfo pc = new OfferPriceInfo(SaleId); if (pc.SendEmployeeName == "") { lblApplyName.Text = pc.PreEmployeeName.ToString();//市场部员工 lblApplyTime.Text = pc.PreApplyTime.ToString(); } else if (pc.PreEmployeeName == "") { lblApplyName.Text = pc.SendEmployeeName.ToString();//市场部经理 lblApplyTime.Text = pc.ApplyTime.ToString(); } int emid = Convert.ToInt32(Session["EmployeeId"]); //绑定子GridView GridView gv = e.Row.FindControl("GridView2") as GridView; int mainid = Convert.ToInt32(pc.MainOfferPriceId); DataTable dt = OfferPriceInfo.getOfferPriceListOfApproves2(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.IsApply2 == 1) { btnSubmit.Enabled = false; } //审批状态 if (pc.IsApply2 == 0) { lblState.Text = "待审"; } else if (pc.IsApply2 == 1) { if (pc.IsOver2 == 0) { lblState.Text = "修正"; } else { lblState.Text = "通过"; } } } } }