Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends, I have a requirement uisng asp.net. I want to display the popup when data is updated in database after that displaying the popup .Popup will be displaying every time data is updated. How can do this requirement in asp.net with c#.net and without using events of controls. automatically coming when data is updated in database of perticular field in the table.

Please any one help me....
Posted
Updated 23-Apr-13 23:46pm
v4

Use UpdatePanel and call a Javascript function after on ajax complete of UpdatePanel
For more information go through this link
http://eligeske.com/asp-net/call-a-javascript-function-on-ajax-complete-of-update-panel-2/[^]

Hope this helps
 
Share this answer
 
Comments
CH Guravaiah 24-Apr-13 6:15am    
Thanks for giving the reply. Can u provide the total code of that requirement.
The best way to get it implemented by using the SignalR. It is completely free to download. We have used this for similar scenarios.
Here is the url:
http://signalr.net/[^]

It is having a wrapped Web Socket functionality to meet these kind of cases. Or you can directly go for Web Sockets:

http://msdn.microsoft.com/en-in/library/ie/hh673567(v=vs.85).aspx[^]

The above are the direct ways for it but still there are alternatives as below.

If you are using the 4.5 version, then you can try the following way.

. From code need to use the Async and Await which need to contact to the DB and wait for a response. If it has got a response that an update happened in DB then can show the popup
. It should be a recursive call. I mean it need to keep open the communiction alive with the async call. Once the wait time is over another one request should go to the db.
. The samething can be done using Thread or .Net's Background_Worker class
. The key thing is that we need to have the Thread or Background_Worker to run recursive.

Here you can see how to use Async: http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx[^]

Hope this helps.

Thank You,
Siju Thomas.
 
Share this answer
 
Simplest solution.

-Implement your update logic and after the update ends put the below lines.

C#
Response.Write("<script type='text/javascript'>");
Response.Write("alert('Database updated succesfully.');");
Response.Write("</script>");
 
Share this answer
 

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