views:

228

answers:

3

I'm building something similar to a price comparison site. This will be developed in ASP.NET/WebForms/C#/.NET 3.5. The site will be used by the public, so I have no control over the client side - and the application isn't so central to their lives that they'll go out of their way to make it work.

I want to have a table/grid that displays products in rows, vendors in columns, and prices in the cells. Price updates will be arriving (at the server) continuously, and I'd like to "push" any updates to the clients' browsers - ideally only updating what has changed. So, if Vendor A changes their price on Product B, I'd want to immediately update the relevant cell in all the browsers that are viewing this information.

I don't want to use any browser plug-ins (e.g. Silverlight). Javascript is fine.

What's the best approach to take?

Presumably my options are:

1) have the client page continuously poll the server for updates, locate the correct cell and update it; or 2) have the server be able to send updates to all the open browser pages which are listening for these updates.

The first one would seem the most plausible, but I don't want to constrain the assembled wisdom of the SO community.

I'm happy to purchase any third party components (e.g. a grid) that might help with this. I already have the DevExpress grid/ajax components if they provide anything useful.

+1  A: 

I didn't think you could 'poll' a browser (IE, Firefox etc) so, the only way I know of to get data is to make the page Request it.

What about refreshing an AJAX update panel every so many seconds. This way the page won't flicker and you will be limiting the amount of data that is being sent back and forth.

iWeasel
+2  A: 

I think your instinct is correct that the pull model is easier to construct. iWeasel mentioned Ajax, and I want point you to Dave Ward's post on jQuery, Ajax and PageMethods in Asp.Net. His blog has an excellent series that will help you achieve what you looking to do.

For validation of Dave's approach, Rick Strahl has a great article on jQuery and Asp.net as well, and in his example he is displaying products in a grid like format.

While I don't have experience with this jQuery plugin, you may want to investigate jQuery Timer to help with your timing intervals.

David Robbins
+1  A: 

you can possibly look at few so-called server side push technologies like - AjaxPush, Comet or even some commercial products like kaazing gateway & lightstreamer

Vikram
I read about Comet on Ajaxian. Do you have direct experience with it?
David Robbins
@David, we are building a Comet based chat solution and are currently exploring different solutions for the same. We have used 2 articles from codeproject.com as the base and here are the links for the same - http://www.codeproject.com/KB/aspnet/wxv_comet.aspx , http://www.codeproject.com/KB/aspnet/AspNetComet.aspx
Vikram