My scenario:
After client login, my user will be redirected to the index.aspx page.
Inside this page I will put one div with a gridview inside.
This gridview will be showing data from one table.
My question is: How to refresh this gridview always that one record is
saved on this table?
Ps.: I´ve seen a lot of examples using “server push” tecnology, comet, ajax, etc.
Don´t know the best way to do that and can´t find a really simple example.
When a new record is added to the table, the real challenge is communicating those changes to the client in real-time without polling in intervals or requiring some sort of user interaction.
You have a couple of options:
Your best bet is to use a WebSocket, which enables bidirectional communication between the client and server. This is the solution I would pick.
Here are some examples using
WebSockets:There are a few good libraries around too that will take care of most of the leg work. A couple to check out are WebSync and PokeIn. Both products offer decent documentation and community editions that you can download for free.
Here are some tutorials to check out:
Use AJAX to poll for changes every
Xnumber of seconds. If changes are detected reload the page, otherwise do nothing.