Question

I have an MVC view that contains a table. One of the columns in the table is an ActionLink that calls a jQuery UI dialog. When a user saves the data collected in the dialog I would like to refresh the MVC view to reflect the new data. Also, many users on other machines could be viewing the "View" at the same time, I would like to update those as well when any client saves new data using the dialog. How can I accomplish this?

Was it helpful?

Solution

Sounds like you want to use SignalR. It would allow you to send notifications from the server to the client. Once all clients would update automatically you don't need to handle anything specially on the client anymore which is performing the change.

Building Real-time Web Apps with ASP.NET WebAPI and WebSockets - describes a bit how you can use SignalR on the client and on the server with WebAPI.

When you get the new data, you can either update them manually in HTML or use frameworks like knockout-JS or AngularJS which allow you to create data-bindings.

However this is quite complicated and I would advise it only if you really want all the other clients to update the data as well. We are solving the problem of updating the table after a change in jQuery-UI-Dialog, by redirecting back to the same URL. This is of course in no way comparable in terms of user experience, but also trivial to implement.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top