Click here to Skip to main content
15,913,097 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to send mail to some clients.After clicking submit button a popup with a label is opened.Now after sending each mail I want to update the text of label in code behind.I know after postback,final result is shown.But in this case after each loop of sending mail I want to update text of label.How is this possible?
I am using c#
Posted

Take one hidden field in your ASPX page.
From Your code behind update the hidden field value. (For example: email sent to abc@xyz.com)

And in your design code (.ASPX page) create one javascript method. for example UpdateLabel()

Now set timer so that this method can be called at every interval of time. (for example every 2 seconds.)

and in this method assign hidden field text to the label text.

This will be reflected.

Happy Coding. :)
 
Share this answer
 
Comments
souvikcode 13-Aug-13 11:18am    
but I don't want timer.After each mail sent I want to update label.How can I know the time for mail sending?
CodeBlack 14-Aug-13 0:12am    
this is the only way i guess. for the timer you can set the interval of every one second. at every second it will check the value of the hidden field and assign that value to the label text.
CodeBlack 14-Aug-13 0:13am    
another way is that you create a handler and on every email sending, pass the message you want to display and assign that message to the label text.
CodeBlack 14-Aug-13 0:20am    
If you dont want to use timer then i have one more suggestion. Create one javascript method. which will update the text of the label. Now once email has been sent successfully, call that javascript method(with message you want to update) from server side. This will also work.
souvikcode 14-Aug-13 12:25pm    
your last suggestion is what I want.I have done that.After sending mail I called a javascript function by registerstartupscript.But label text is not updated.
On pre_Render event we can change the value of any server control
 
Share this answer
 
Comments
souvikcode 13-Aug-13 11:19am    
after the loop of mail send how to call pre_render?

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