Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
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
Posted
Updated 10-May-16 15:46pm
Comments
Sergey Alexandrovich Kryukov 10-May-16 16:02pm    
The question is pretty interesting. It has apparent solutions with the server push (WebSockets, SignalR), but maybe it would be the overkill...
May I ask you: how do you get several messages and send deliver them to the server side? Is that the same message sent to a set of addressees, or completely different messages?
—SA
monafr81 10-May-16 17:24pm    
Well, i think i did not get your point, if you have a solution please help . thanks
Sergey Alexandrovich Kryukov 10-May-16 18:20pm    
I don't have anything else so far; I would like you to answer my question first.
If you did not get what I mean (perhaps, it's about "server push", do you understand what is that and why?), I'll try to clarify.
—SA

1 solution

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.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900