admin can change values in table which consists of
customer_id and other columns
when changes are made
a mail must be sent to customer,
the mail address is available in customerdetails table
protected void GridView1_RowUpdated(object sender, GridViewUpdatedEventArgs e) { Label2.Text = GridView1.Rows[GridView1.EditIndex].Cells[2].Text.ToString(); getcustid(); getmail(); getDetails(); mailcust(); } void getmail() { try { SqlConnection conn3 = new SqlConnection(conn); String q1; q1 = "select cCust_Email from cust_details where cCust_ID ='" + Label7.Text + "'"; SqlCommand cmd = new SqlCommand(q1, conn3); conn3.Open(); SqlDataReader odr1 = cmd.ExecuteReader(); odr1.Read(); if (odr1.HasRows) { MailTextBox.Text = odr1[0].ToString(); } } catch (Exception ex) { } } void getcustid() { SqlConnection conn3 = new SqlConnection(conn); String q1; q1 = "select cCust_ID from orders where cOrder_ID ='" + Convert.ToInt32(Label2.Text) + "'"; SqlCommand cmd = new SqlCommand(q1, conn3); conn3.Open(); SqlDataReader odr1 = cmd.ExecuteReader(); odr1.Read(); if (odr1.HasRows) { Label7.Text = odr1[0].ToString(); } } void mailcust() { try { MailMessage mail = new MailMessage(); mail.To.Add(MailTextBox.Text); mail.From = new MailAddress("sender@gmail.com"); mail.Subject = "Shipping Details"; mail.Body = Label3.Text + TextBox1.Text + Label4.Text + TextBox2.Text + Label5.Text + TextBox3.Text + Label6.Text + TextBox4.Text; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Credentials = new System.Net.NetworkCredential("sender@gmail.com", "senderpass"); smtp.EnableSsl = true; smtp.Port = 587; smtp.Send(mail); } catch (Exception ex) { Response.Write(ex.Message); } } void getDetails() { try { SqlConnection conn3 = new SqlConnection(conn); String q1; q1 = "select * from ordermng where ship_id ='" + Convert.ToInt32(Label2.Text) + "'"; SqlCommand cmd = new SqlCommand(q1, conn3); conn3.Open(); SqlDataReader odr1 = cmd.ExecuteReader(); odr1.Read(); if (odr1.HasRows) { TextBox1.Text = odr1[0].ToString(); TextBox2.Text = odr1[1].ToString(); TextBox3.Text = odr1[2].ToString(); TextBox4.Text = odr1[3].ToString(); } } catch (Exception ex) { } }
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.