public void EmailSetting() { try { string transfrom = string.Empty; string transTo = string.Empty; BALFacility lclfacility = new BALFacility(); lclfacility.SearchText = drpTransFrom.SelectedItem.Text; lclfacility.Active = ""; lclfacility.LogginBy = defaultPage.UserId; lclfacility.Filter = ""; List <BindFacility> lstfac = lclsservice.BindFacility(lclfacility).ToList(); transfrom = lstfac[0].FacilityShortName; lclfacility.SearchText = drpTransTo.SelectedItem.Text; List <BindFacility> lstfacTo = lclsservice.BindFacility(lclfacility).ToList(); transTo = lstfacTo[0].FacilityShortName; string FirstMessage = string.Empty; string NextMessage = string.Empty; string FinalMessage = string.Empty; FirstMessage = string.Format("Transfer from " + transfrom + " " + "to" + " " + transTo + " " + "was created on" + " " + txtTransferDate.Text + " " + "<br/>" + "Please see information below"); foreach (GridViewRow row in grdTRReview.Rows) { string TransferID = row.Cells[0].Text; HdnTransferOutID.Value = TransferID; string TransferDate = row.Cells[1].Text; string TransferFrom = drpTransFrom.SelectedItem.Text; Label ItemID = (Label)row.FindControl("ItemID"); string ItemCategory = drpItemCategory.SelectedItem.Text; Label ItemDescription = (Label)row.FindControl("ItemDescription"); Label UomName = (Label)row.FindControl("UomName"); Label lblQtyPack = (Label)row.FindControl("lblQtyPack"); Label lblprice = (Label)row.FindControl("lblprice"); TextBox txtTransferQty = (TextBox)row.FindControl("txtTransferQty"); Label lblTotalPrice = (Label)row.FindControl("lblTotalPrice"); string status = StatusPendingTransfer; List <GetFromEmailforTransfer> Audit = lclsservice.GetFromEmailforTransfer(HdnTransferNo.Value).Where(a => a.ItemID == Convert.ToInt64(ItemID.Text)).ToList(); string Append = "<tr style='border: 1px solid black;'><td style='border: 1px solid bla'>" + TransferID + "</td><td style='border: 1px solid black;'>" + TransferDate + "</td><td style='border: 1px solid black;'>" + TransferFrom + "</td><td style='border: 1px solid black;'>" + ItemID.Text + "</td><td style='border: 1px solid black;'>" + ItemCategory + "</td><td style='border: 1px solid black;'>" + ItemDescription.Text + "</td><td style='border: 1px solid black;'>" + UomName.Text + "</td><td style='border: 1px solid black;'>" + lblQtyPack.Text + "</td><td style='border: 1px solid black;'>" + lblprice.Text + "</td><td style='border: 1px solid black;'>" + txtTransferQty.Text + "</td><td style='border: 1px solid black;'>" + lblTotalPrice.Text + "</td><td style='border: 1px solid black;'>" + status + "</td><td style='border: 1px solid black;'>" + Audit[0].Audit + "</td></tr>"; NextMessage += Append; } NextMessage = "<table style='width: 1080px;text-align: left;background-color:#ededee;border-collapse: collapse;border: 1px solid black'> <tr style='background-color:#006dd7; color: white;padding: 10px;border: 1px solid goldenrod;'> <th style='border: 1px solid black;'>Transfer Id</th><th style='border: 1px solid black;'>Transfer Date</th><th style='border: 1px solid black;'>Transferred from</th><th style='border: 1px solid black;'>SNG Item ID</th><th style='border: 1px solid black;'>Item Category</th><th style='border: 1px solid black;'>Item Description</th><th style='border: 1px solid black;'>Uom</th><th style='border: 1px solid black;'>Qty/Pack</th><th style='border: 1px solid black;'>Price</th><th style='border: 1px solid black;'>Received Qty(Each)</th><th style='border: 1px solid black;'>Total Price</th><th style='border: 1px solid black;'>Status</th><th style='border: 1px solid black;'>Audit Trail</th></tr>" + NextMessage + "</table>"; objemail.vendorEmailcontent = FirstMessage + NextMessage + FinalMessage; objemail.vendoremailsubject = "Transfer Order – " + HdnTransferNo.Value; } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.TransferOutErrorMessage.Replace("<<TransferOut>>", ex.Message.ToString()), true); } }