void grdAds_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.DataRow) { return; } Order o = (Order)e.Row.DataItem; Status s = new Status(); int sts = o.STATUS_ID; s.Load(sts); IList <Order> orders = new List <Order>(); orders = o.LoadByUserId(Convert.ToInt32(Session["USER_ID"])); Label lblAllocated = (Label)e.Row.FindControl("lblAllocated"); User u = new User(); int usr = o.USER_ID; u.Load(usr); if (usr == 0) { lblAllocated.Text = "No One"; } else { lblAllocated.Text = u.RealName; } if (chkTake == false && orders.Count == 0) { e.Row.Cells[9].Visible = true; chkTake = true; } else { e.Row.Cells[9].Visible = false; User u1 = new User(); u1.Load(Convert.ToInt32(Session["USER_ID"])); if (u1.STATUS_ID != 3) { e.Row.Cells[10].Visible = false; if (Request["UserId"].ToString() == "0") { e.Row.Cells[10].Visible = false; } else if (Request["UserId"].ToString() == "x" && (u1.RealName != lblAllocated.Text)) { e.Row.Cells[10].Visible = false; } else if (u1.RealName == lblAllocated.Text) { e.Row.Cells[10].Visible = true; } else { e.Row.Cells[10].Visible = true; } } } Label lblSeriolNo = (Label)e.Row.FindControl("lblSeriolNo"); lblSeriolNo.Text = i.ToString(); i++; Label lblOrderDate = (Label)e.Row.FindControl("lblOrderDate"); lblOrderDate.Text = o.ORDER_DATE.ToString(("MM/dd/yyyy")); Label lblPriority = (Label)e.Row.FindControl("lblPriority"); Priority pr = new Priority(); int pri = o.PRIORITY; pr.Load(pri); if (pr.Priority_Name == "Regular") { lblPriority.ForeColor = System.Drawing.Color.Black; lblPriority.Text = pr.Priority_Name; } else { lblPriority.ForeColor = System.Drawing.Color.Red; } lblPriority.Text = pr.Priority_Name; Label lblStatus = (Label)e.Row.FindControl("lblStatus"); lblStatus.Text = s.ORDER_STATUS; Label lblLastDesigner = (Label)e.Row.FindControl("lblLastDesigner"); Label lblLastQA = (Label)e.Row.FindControl("lblLastQa"); Change change = new Change(); Change ch = change.LoadByOrderId(Convert.ToInt32(o.ORDER_ID)); lblLastDesigner.Text = ch.Design_By_Name; lblLastQA.Text = ch.Qa_By_Name; IList <AdsCom.UserHistory> usrHis = AdsCom.UserHistory.LoadByOrderId(o.ORDER_ID); if (usrHis.Count > 0) { User usrs = new User(); UserHistory uh = new UserHistory(); int hisUserId = AdsCom.UserHistory.LoadByOrderId(o.ORDER_ID)[0].User_Id; usrs.Load(hisUserId); string name = usrs.RealName; Label lblLastComment = (Label)e.Row.FindControl("lblLastComment"); string strAction = string.Empty; if (o.ACTION == 1) { strAction = "Completed"; } else if (o.ACTION == 2) { strAction = "Hold"; } else if (o.ACTION == 3) { strAction = "Return"; } lblLastComment.Text = strAction + " (" + o.ALBUM_RATING + ") " + o.COMMENTS + " ( By " + name + ") "; } LinkButton hypTake = (LinkButton)e.Row.FindControl("hypTake"); hypTake.CommandArgument = o.Id.ToString(); //hypTake. = "ListQueue.aspx?StatusId=" + o.Status + "&UserId=" + Session["USER_ID"] + ""; HyperLink hypView = (HyperLink)e.Row.FindControl("hypView"); hypView.NavigateUrl = "ShowOrder.aspx?AID=" + o.Id + "&UserId=" + Session["USER_ID"] + ""; }