更新面板可见性隐藏在“邮件发送成功”之后
本文关键字:成功 之后 可见性 隐藏 更新 | 更新日期: 2023-09-27 18:09:39
我有一个有两个更新面板的页面- updatepanelform(可见),updatepanelthanks(隐藏)。我用这个方法在asp页面上点击按钮事件时发送邮件。
protected void BtnRfqClick(object sender, EventArgs e)
{
// Gmail Address from where you send the mail
var fromAddress = TbEmailRfq.Text.ToString();
// any address where the email will be sending
var toAddress = "user@gmail.com";
//Password of your gmail address
var name = TbNameRfq.Text.ToString();
const string fromPassword = "password";
// Passing the values and make a email formate to display
string subject = "Welcome To world";
string body = "Name :" + TbNameRfq.Text.ToString() + Environment.NewLine +
"Email Id :" + TbEmailRfq.Text.ToString()
+ Environment.NewLine + TaComment.InnerText.ToString();
// smtp settings
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential("user email", "password");
smtp.Timeout = 20000;
}
// Passing values to smtp object
smtp.Send(fromAddress, toAddress, subject, body);
}
一切都很好,但我无法设置updatepanelform的可见性隐藏和updatepanelthanks可见后,它发送电子邮件成功。
在发送邮件后放置以下内容:
updatepanelform.Visible = false;
updatepanelthanks.Visible = true;