public override void VerifyRenderingInServerForm(Control control){}private string GridViewToHtml(GridView gv){StringBuilder sb = new StringBuilder();StringWriter sw = new StringWriter(sb);HtmlTextWriter hw = new HtmlTextWriter(sw);gv.RenderControl(hw);return sb.ToString();} protected void Button3_Click(object sender, EventArgs e){//checkoutif (txtgrandtotal.Text == ""){//click on total buttonclsdataset.ShowAlertMessage("click on total"); }else{ SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["InventoryConnectionString"].ConnectionString);string note = TextBox2.Text;Session["note"] = note.ToString();CheckBox cc; Label id; Label categorynamee; Label itemkey; Label itemkeynamee; Label currentqty; Label salesprice;Label quantity; Label total;foreach (GridViewRow rr in GridView1.Rows){cc = (CheckBox)rr.FindControl("chk");id = (Label)rr.FindControl("Label2");categorynamee = (Label)rr.FindControl("Label3");itemkey = (Label)rr.FindControl("Label4");itemkeynamee = (Label)rr.FindControl("Label5");currentqty = (Label)rr.FindControl("Label6");salesprice = (Label)rr.FindControl("Label7");quantity = (Label)rr.FindControl("Label8");total = (Label)rr.FindControl("Label1"); Session["Orderno"] = id.Text;if (cc.Checked == true && cc.Visible == true){//update tblorder//SqlCommand cmdupd = new SqlCommand("addnotesproc", con1);//con1.Open();//cmdupd.CommandType = CommandType.StoredProcedure;//cmdupd.Parameters.AddWithValue("@OrderNo", Convert.ToInt32(id.Text));//cmdupd.Parameters.AddWithValue("@Note", TextBox2.Text);//cmdupd.ExecuteNonQuery();//con1.Close();//insert TblDetailsSqlCommand cmptbldetails = new SqlCommand("Addorderdetails", con1);cmptbldetails.CommandType = CommandType.StoredProcedure;con1.Open();cmptbldetails.Parameters.AddWithValue("@OrderNo",Convert.ToInt32(id.Text));cmptbldetails.Parameters.AddWithValue("@CategoryNameE",categorynamee.Text);cmptbldetails.Parameters.AddWithValue("@ItemKey",itemkey.Text);cmptbldetails.Parameters.AddWithValue("@ItemKeyNameE",itemkeynamee.Text); cmptbldetails.Parameters.AddWithValue("@CurrentQTY",currentqty.Text);cmptbldetails.Parameters.AddWithValue("@SalesPrice",salesprice.Text);cmptbldetails.Parameters.AddWithValue("@Quantity",quantity.Text);cmptbldetails.Parameters.AddWithValue("@Total",total.Text);cmptbldetails.Parameters.AddWithValue("@time1", DateTime.Now.ToString());cmptbldetails.Parameters.AddWithValue("@Notes", TextBox2.Text); cmptbldetails.ExecuteNonQuery();con1.Close();} } //updating tblorder //upto here System.Net.Mail.SmtpClient smtp = new SmtpClient();System.Net.Mail.MailMessage msg = new MailMessage();MailAddress fromaddress = new MailAddress("[email protected]");msg.From = fromaddress; string mailto = Session["Areamanager"].ToString();msg.To.Add(mailto); msg.Subject = "your Purchase Details";msg.Body = "ShopId::" + Session["UserName"].ToString() + "<br><br>" + "ShopName::" + Session["sendershopname"].ToString() + "<br><br>" + "OrderNo::" + Session["Orderno"].ToString() + "<br><br>" + "OrderDate::" + DateTime.Now.ToString() + "<br><br>" + "Total::" + Session["total"].ToString() + "<br><br>" + Session["note"].ToString() + "." + "<br><br>" + GridViewToHtml(GridView1);msg.IsBodyHtml = true;smtp.Host = "localHost";smtp.Port = 25;smtp.UseDefaultCredentials = true;smtp.Send(msg); Response.Redirect("mailsend.aspx"); }}