I want to update my gridview in other browser when i upload file in current browser..i use signalR to implement that.. here is my source code.. here is my NotificationHub.vb
Code
Imports System.Web
Code
Imports Microsoft.AspNet.SignalR
Code
Namespace SignalRChat
Code
Public Class NotificationHub
Code
Inherits Hub
VB.NET
Public Sub Send(name As String, message As String)
Code
             ' Call the broadcastMessage method to update clients.
Code
Clients.All.broadcastMessage(name, message)
Code
End Sub
Code
End Class
Code
End Namespace

Here is Startup.vb

Code
Imports Microsoft.AspNet.SignalR
Code
Imports Microsoft.Owin.Security
Code
Imports Owin
Code
Imports Microsoft.Owin
Code
'add the attribute here
Code
<Assembly: OwinStartup(GetType(SignalRTutorials.Startup))>
Code
Namespace SignalRTutorials
Code
Public Class Startup
Code
Public Sub Configuration(app As IAppBuilder)
Code
'app.MapSignalR()
Code
Dim hubConfiguration = New HubConfiguration()
Code
hubConfiguration.EnableDetailedErrors = True
Code
hubConfiguration.EnableJavaScriptProxies = True
Code
app.MapSignalR("/signalr", hubConfiguration)
Code
End Sub
Code
End Class End Namespace

in home.aspx

Code
var NotificationHub = $.connection.NotificationHub;
Code
NotificationHub.client.refresh = function (stock) {
Code
//Just some tracing purposes
Code
//console.log('Refresh method triggered successfully!');
Code
//console.log(stock);
Code
//Refresh the gridview with latest data
Code
$("#Gridview1").each(function (i) {
Code
if ($(<code></code>this)[0].id == stock.ID) {
Code
//highlight the row that has data changed then slowly fade
Code
$(this).attr('style', 'background-color: yellow;');
Code
$(this).animate({ backgroundColor: 'white' }, 3000);
Code
}
Code
});
Code
};
Code
$.connection.hub.start().done(function () {
Code
//Just to trace whether your browser successfully connected to SignalR hub
Code
console.log('Connected to SignalR hub, connection ID = ' + $.connection.hub.id);         })
 
and the last in home.aspx.vb (i write this code after upload's code)
Code
Dim context = GlobalHost.ConnectionManager.GetHubContext(Of NotificationHub)()
Code
Dim aTimer = New System.Timers.Timer(1000)
Code
aTimer.Interval = 3000
Code
aTimer.Enabled = True
Code
context.Clients.All.refresh()

i hope you can help me everyone.. thanks Smile | :)