protected void BtnSendMail_Click(object sender, EventArgs e) { try { IncentiveBusiness b = new IncentiveBusiness(); EmailDetails details = new EmailDetails(); SendMailObject obj = new SendMailObject(); details.FromEmail = ConfigurationManager.AppSettings["FromAddress"].ToString(); string finance_emailid = Session["emailId"].ToString(); int Index = ((GridViewRow)((sender as Control)).NamingContainer).RowIndex; string employeeid = Gridview.Rows[Index].Cells[0].Text; string referenceid = Gridview.Rows[Index].Cells[1].Text; string transctiontype = Gridview.Rows[Index].Cells[5].Text; Session["transctiontype"] = transctiontype; Session["MemberId"] = employeeid; Session["referenceid"] = referenceid; string membertype = Gridview.Rows[Index].Cells[6].Text; string emailid = null; if (membertype == "M") { emailid = b.SelectAuthorEmailId(employeeid); } else { //emailid = b.SelectStudentAuthorEmailId(employeeid); string id = ""; emailid = b.SelectStudentEmailId(employeeid, id); } string hr_emaild = b.SelectHREmailId(employeeid, referenceid, transctiontype); PanelSendMail.Visible = true; if (emailid != "") { txtTo.Text = hr_emaild + ',' + emailid; } else { txtTo.Text = hr_emaild; } txtCC.Text = finance_emailid; foreach (GridViewRow row in Gridview.Rows) { if (row.RowIndex == Index) { row.BackColor = ColorTranslator.FromHtml("#A1DCF2"); } else { row.BackColor = ColorTranslator.FromHtml("#FFFFFF"); } } } catch (Exception ex) { log.Error(ex.StackTrace); log.Error(ex.Message); //return obj1; } }