I am trying get the changed values from the sqlserver using the server_broker feature.
my code is like below
protected void Page_Load(object sender,
All the code you've shown is ASP.Net side code. The grid is shown on the client, is an HTML element. you need to notify the client of the change. HTTP refresh is not a trivial issue, you have to either:
Content-Type: text/event-stream
) but this is not supported by IEPolling works but it can get taxing on the server, specially with large number of clients. There are countless examples of ASP.Net backed polling using Ajax.
WebSockets requires Windows 8/windows Server 2012 and IIS 8, see Support for WebSockets Protocol
You should probably also look into SignalR, which is an ASP.Net library specifically developer for pushing updates to the client.
As you can see, my answer does not even touch the topic of Query Notifications. Getting the notification from the DB to the ASP.Net middle tier is only one part of the equation, and SqlDependency
is indeed the right answer. But you're completely missing the second part, the pushing of notification from mid-tier to the browser. You should only notify the browser that the update occurred and the client should refresh. Let the refresh load the data using the usual Page_load event. Use SqlCacheDependency to server the page, this will automatically cache results and refresh the cache on any update.