protected void gvAdjustments_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         int UserID = (int)DataBinder.Eval(e.Row.DataItem, "CreatedBy");
         if (UserID != 0)
         {
             Literal aa = e.Row.FindControl("CreatedByLiteral") as Literal;
             if (aa != null)
             {
                 using (UserManager um = new UserManager())
                 {
                     User user = um.GetUserByID(UserID);
                     if (user != null) aa.Text = user.UserName;
                 }
             }
         }
     }
 }
        private void Populate()
        {
            if (Request.QueryString["ID"] != "")
            {
                int adjID = int.Parse(Request.QueryString["ID"]);
                using (AdjustmentVoucherManager avm = new AdjustmentVoucherManager())
                {
                    AdjustmentVoucher tran = avm.FindAdjustmentVoucherByID(adjID);
                    this.gvAdjustmentItems.DataSource = tran.StockLogs.ToList<StockLog>();
                    this.gvAdjustmentItems.DataBind();

                    lblVoucherNumber.Text = tran.VoucherNumber;
                    lblIssueDate.Text = tran.DateIssued.ToShortDateString();
                    using (UserManager um = new UserManager())
                    {
                        User u = um.GetUserByID(tran.CreatedBy);
                        lblCreatedBy.Text = u.UserName;
                    }
                    decimal totalCost = avm.GetTotalCostVoucher(tran);
                    lblCost.Text = String.Format("{0:C}", totalCost);
                }
            }
        }