title: Applying SignalR to update gridview
body: <p>So  when using signalR. I followed this example and got it working on a test web form, where in I open 2 tabs of the same page and tested it out:</p>
  <p><a href="https://docs.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr" rel="nofollow noreferrer">SignalR Tutorial</a></p>
  <p>Now I tried to modify it a little bit and tried to have 1 page as a sender and another as a receiver,</p>
  <p>Page with Button to send message:</p>
  <pre><code>   &lt;script type=&quot;text/javascript&quot;&gt;
          $(function () {
              // Declare a proxy to reference the hub. 
              var msg = $.connection.myHub1;   //change MyHub1.cs should be in camel myHub
              // Create a function that the hub can call to broadcast messages.
              msg.client.broadcastMessage = function (name, message) {
                  // $(&quot;[id*=btnRefresh]&quot;).click();
              };
              // Start the connection.
              $.connection.hub.start().done(function () {
                  function RefreshData() {
                      // Call the Send method on the hub. 
                      msg.server.send('admin', 'Refresh Grid');
  
  
                  };
              });
          });
      &lt;/script&gt;
  
    protected void btnSendMsg_Click(object sender, EventArgs e)
      {
           ClientScript.RegisterStartupScript(GetType(), &quot;SigalRFunction&quot;, &quot;RefreshData()&quot;, true);
      }
  </code></pre>
  <p>Page with gridview:</p>
  <pre><code> &lt;asp:Button runat=&quot;server&quot; ID=&quot;btnRefresh&quot; OnClick=&quot;btnRefresh_Click&quot; Style=&quot;display: none&quot; /&gt;
   &lt;script type=&quot;text/javascript&quot;&gt;
          $(function () {
              // Declare a proxy to reference the hub. 
              var msg = $.connection.myHub1;   //change MyHub1.cs should be in camel myHub
              // Create a function that the hub can call to broadcast messages.
              msg.client.broadcastMessage = function (name, message) {
  
                  $(&quot;[id=btnRefresh]&quot;).click();
                  
  
              };
              // Start the connection.
              $.connection.hub.start().done(function () {
                  function RefreshData() {
                      // Call the Send method on the hub. 
                      //msg.server.send('admin', 'Refresh Grid');
  
  
                  };
              });
          });
      &lt;/script&gt;
   protected void btnRefresh_Click(object sender, EventArgs e)
      {
          grdview.DataSource = grdviewData();
          grdview.DataBind();
      }
  </code></pre>
  <p>My idea was every time a message is received, the grid view/page should should automatically refresh. The grdviewDatasource and Databind works  i.e placed it in pageload.Sadly nothing happens.</p>
  <pre><code>script src=&quot;assets/js/app.min.js&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;assets/js/scripts.js&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;assets/js/custom.js&quot;&gt;&lt;/script&gt;
  
      &lt;script src=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js&quot;&gt;&lt;/script&gt;
  
  
      &lt;script src=&quot;https://code.jquery.com/ui/1.12.1/jquery-ui.js&quot;&gt;&lt;/script&gt;
  
      &lt;!--Script references. --&gt;
      &lt;!--Reference the jQuery library. --&gt;
      &lt;script src=&quot;Scripts/jquery-1.10.2.min.js&quot;&gt;&lt;/script&gt;
      &lt;!--Reference the SignalR library. --&gt;
      &lt;script src=&quot;Scripts/jquery.signalR-2.1.2.min.js&quot;&gt;&lt;/script&gt;
      &lt;!--Reference the autogenerated SignalR hub script. --&gt;
      &lt;script src=&quot;signalr/hubs&quot;&gt;&lt;/script&gt;
      &lt;!--Add script to update the page and send messages.--&gt;
  
  
  
    
  </code></pre>