如何在发送电子邮件的代码中显示标签中发送的邮件数量? [英] How to display the number of message sent in a label while the code sending the emails?

查看:104
本文介绍了如何在发送电子邮件的代码中显示标签中发送的邮件数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i正在使用网络应用程序 - c# - ,我有一个向用户发送电子邮件的按钮,我正在使用asp.net带有加载图片的进度条,我想放一个标签显示发送5条消息中的2条,告诉用户发送的实际消息,但标签不显示消息数量,直到按钮完成发送电子邮件,但我希望标签显示按钮发送电子邮件的同时消息的数量,任何想法如何做到这一点,我已经尝试了很长时间但没有用,等待你的帮助



谢谢大家>



我尝试了什么:



i尝试使用j查询,我也试过回地面工作者

Hi all,

i am working on a web application- c#- , i have a button which sending emails to the users , and i am using asp.net progress bar with loading image , i want to put a label to display " 2 of 5 messages are sent" , to tell the user the actual messages sent, but the label does not display the number of messages until the button is done sending the emails,but i wanna the label display the number of messages in same time the button is sending the emails , Any idea how to do this, i have been trying for a long time but no use,waiting for you help

Thank you all >

What I have tried:

i tried using j query , also i tried back ground worker

推荐答案

我知道你已尝试过jQuery,但不知道怎么样。

以下是我用jQuery做的方法。



假设您有一个表,gridview或承载要发送的消息列表的任何控件的消息列表。

步骤:



1.将这些消息放入JavaScript数组中(此数组项应包含发送电子邮件所需的所有信息)

2.有一个已处理消息的计数器

3.遍历JavaScript数组并在每个循环中,将消息发送到同一Web应用程序中的Web服务(沿具有将电子邮件作为JSON对象发送所需的所有信息)以JSON格式返回结果以识别是否已发送,然后显示#number的已处理消息#number of total messages(JavaScript数组中的总数)



通过这种方式,您可以识别未发送的消息而不会阻止您的前端。



如果您需要任何进一步的帮助,请随时发表评论。



希望这会有所帮助。



如果这样做,请不要忘记将答案标记为正确答案帮助了你。
I know you have tried with jQuery, but don't know how.
Here is how I would do it with jQuery.

Suppose you have a list of messages in a table, gridview, or whatever control that hosts the list of messages to be sent.
Steps:

1. Put those messages in a JavaScript array (This array item should have all the information necessary to send the email)
2. Have a counter of processed messages
3. Loop through the JavaScript array and in each loop, send the message to a web service in the same web application (along with all the information necessary to send the email as JSON object) returning results in JSON format to identify whether it was sent or not and then display #number of processed messages out of #number of total messages (total in the JavaScript array)

This way you will be able to identify which messages are not sent without blocking your front end.

If you need any further help, feel free to post comment.

Hope this helps.

Don't forget to mark the answer as a correct answer if this helped you.


这篇关于如何在发送电子邮件的代码中显示标签中发送的邮件数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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