views:

148

answers:

1

Hi.

Is there any way to have a datagrid listen to the database and automatically update the data if the database data is changed? I use a SQL Server database.

I'd like to use Linq-2-SQL if possible

thx in advance :D

+1  A: 

It depends from where you are updating the database:

  • From the same context (in Silverlight, are you adding, deleting, editing on the same page)
  • From a ChildWindow in your Silverlight application
  • From an external, non-related tool, outside of your Silverlight application
Sam
I'm so glad you ask that, and sorry for not providing that info in the first place. My silverlight app contains a tabcontrol, that contains UC's I consider implementing an ITabUserControl interface that has a updateonselected method and then update the ui every time a tab is selected. There will be many clients, so I think SqlDependencies will cause a too heavy load. How does that sound to you guys?
Jakob
I guess you'll have to consider "x users clicking y-tabs every z-time". If you have quite an amount of clients clicking away on your tabs I take it you will have a huge amount of traffic going back and forth depending on the amount of data required. Assuming you realize this, if you have a big enough of hardware to back up the traffic this will produce I don't see a problem with the SelectedTabChanged approach, although being web, I'd prefer a pagechange over a tabchange to present new data, where the users are more used to as seeing new data. Have you considered a refresh button?
Sam