发送邮件时显示进度条或处理图像... [英] Display progress bar or processing image while sending mail...

查看:54
本文介绍了发送邮件时显示进度条或处理图像...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...,

我想发送邮件..因此,发送时,我需要一个进度条或处理图像(或状态),发送邮件后,它应该会消失...您能帮我吗..plz. ..
这是邮件发送的代码...

Hi...,

I want to send a mail..So while sending ,I need a progress bar or processing Image(or status) and after sending mail ,it should disappear...Can you help me..plz...
Here is the code for mail sending...

public string SendMail(string emailId, string UserName)
{
    string status = string.Empty;
    DataSet dsLoginCredentials = new DataSet();
    try
    {       
        MailAddress SendFrom = new MailAddress("....", "....");
        // to mailid from argument emailId
        MailAddress SendTo = new MailAddress(emailId);
        MailMessage MyMessage = new MailMessage(SendFrom, SendTo);
        MyMessage.Subject = "Login Credentials";
        MyMessage.Body = "Dear " + UserName + " your user name for login :" + emailId + "\n" + " and Password : " + UserName;
        SmtpClient emailClient = new SmtpClient("smtp.gmail.com");
        emailClient.Port = 25;
        emailClient.Credentials = new NetworkCredential("...", "....");
        emailClient.EnableSsl = true;
        emailClient.Send(MyMessage);    
    }
    catch (Exception ex)
    {
        status = "Mail Sending Failed";
    }
    return status;
}


[Edit:Added pre tags]


推荐答案

嗨Aravind,
您粘贴的代码块是服务器端.您无法使用回发显示所需的状态.更改您的代码库以使用AJAX并使用JavaScript来显示状态.

一切顺利.
Hi Aravind,
The code block you pasted are Server Side. You cannot show a status as you wanted using Postback. Change you code base to use AJAX and use JavaScript for showing the statuses.

All the best.


嗨Arvind,
您可以使用ajax updatepanel和updateprogress控件来获取处理状态.假设您有一个发送电子邮件的按钮,则需要将该按钮放入updatepanel并设置updateprogress的updatepanelId.在这种情况下,只要您单击该按钮,就会显示处理图像,直到进行处理为止.

谢谢
Hi Arvind,
You can use ajax updatepanel and updateprogress controls to get processing status. Suppose you have a button to send email then you need to put that button into updatepanel and set updateprogress''s updatepanelId. In this case whenever you will click on that button processing image will be displayed till the processing is occurring.

Thanks


这篇关于发送邮件时显示进度条或处理图像...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆