protected void btncancel_Click(object sender, EventArgs e) { Button btn = sender as Button; GridViewRow row = btn.NamingContainer as GridViewRow; int id = int.Parse(grd_leaves.DataKeys[row.RowIndex].Value.ToString()); bus.lid = id; int r = bus.cancel_leave(); if (r == 1) { fetch_hr_email(); mailbody = "<table border='1' cellpadding='0' cellspacing='0' style='width: 850px; border-color: black;'><tr><td colspan='9'><br>   Dear Sir / Madam,<br /><br />     Leave application submitted by <b>" + Session["name"].ToString() + "</b> has been cancelled on <b>" + DateTime.Now.ToString("dd/MM/yyyy") + ".</b> The details are as follows.<br /><br /></td></tr><tr style='font-weight: 700;'></tr><tr><td colspan='9'><br/><p></p><p>    Name: " + Session["name"].ToString() + "</p><p>   Department: " + Session["dep"].ToString() + "</p><p>   Designation: " + Session["des"].ToString() + " </p><p>   Leave Type: " + row.Cells[1].Text.ToString() + " </p><p>   Period: " + row.Cells[4].Text.ToString() + " </p><p>   click<a href=" + url2 + "> here </a>to login into the application (UOA)</p><p>   </p><p>   click<a href=" + url + "> here </a>to login into the application (Non UOA)</p><br/></td></tr><tr></tr><td colspan='9' style='font-weight: bold' align='right'><br /><br />Regards,<br />Team e-leave</td></tr><tr><td align='center'><p style='color:blue;'> This is a system generated response. Please do not respond to this email id.</p></td></tr></table>"; bool check = SendWebMail(toemail, "Leave Application Notification", mailbody, "", "", "*****@*****.**"); if (check == true) { fill_grid(); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "success();", true); } else { fill_grid(); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "errormail();", true); } } else { fill_grid(); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "error();", true); } }