我想显示像旋转圆圈一样的预加载图像,请在按钮单击时等待文本等,并在功能完成时显示警告消息。 在我的方案按钮单击中,调用后面的代码方法来发送电子邮件。发送电子邮件时,我想显示预加载器,完成时应显示警告信息。以下是我的代码。
protected void btnSubmit1_Click(object sender, EventArgs e)
{
const string esender = "emailid@email.com";
const string sp = "password";
string bodyMessage = "";
//string text = txtmsg.text;
try
{
SmtpClient smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
Credentials = new System.Net.NetworkCredential(esender, sp),
Timeout = 30000
};
bodyMessage = "Details of the sender\n" +
"Name : " + txtName.Text + "\n\n" +
"Email : " + txtemail.Text + "\n\n" +
"Contact : " + txtNumber.Text + "\n\n" +
"Subject : " + txtsubject.Text + "\n\n" +
"Message : " + txtmsg.Text;
MailMessage message = new MailMessage(esender, "receiver@gmail.com","Customer Enquiry", bodyMessage);
smtp.Send(message);
}
catch (Exception ex)
{
}
}
按钮的和aspx代码
<asp:Button ID="btnSubmit1" Text="Submit Message" class="btn btn-primary btn-lg" OnClick="btnSubmit1_Click" runat="server" />