如何在多个局部视图页面使用SignalR Hub? [英] How can use SignalR Hub at multiple partial view page?

查看:266
本文介绍了如何在多个局部视图页面使用SignalR Hub?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带SignalR的示例项目并测试实时信息。

在我的项目中是来自某个页面的输入数据,并在一个页面上实时显示列表数据。

当我使用多个表格/视图(报名表,列表表格)时,可以使用SignalR。

但是当我使用单个表格/视图与多个部分表格时,我遇到了问题,SignalR Hub不是当我将数据插入Entry From(部分)时,清单表格(部分)可以显示实时数据。

但单一表格(视图)可以看到实时数据的到来。我认为这是部分页面中的问题。

在Firebug中,没有错误信息,只是不工作。

我跟着Asp.Net论坛

I have a sample project with SignalR and test for real time information.
In my project is entry data from some page and show list data at one page in real time.
It okay with SignalR when I use Multiple Form/View ( Entry Form, Listing Form ).
But I got issue when I use Single Form/View with multiple Partial Form, SignalR Hub is doesn't work when I insert data to Entry From (partial), Listing Form(partial) can show real time data.
But Single Form(view) is can see real time data coming. I think this is issue of in Partial page.
In Firebug, there is no error message, just don't work.
I'm follow Asp.Net Forums.

//--- in my view pages ---
$(function() { window.hubReady = $.connection.hub.start(); });

//--- in my partial pages ---
$(function() { window.hubReady.done(function() { // call hub method }); }); 



但是当我打电话给


But when I call

window.hubReady.done(function() {});



在部分页面,我收到错误 hubReady不是功能

请参阅我的样本表格

如果你可以建议我真的很感激。

谢谢,

MinChanSike


at Partial page,I'm get error hubReady is not function.
Please see My Sample Form.
If you can suggest I'm really appreciate it.
Thanks,
MinChanSike

推荐答案

function (){ window .hubReady =
(function() { window.hubReady =


.connection.hub.start( );});

// ---在我的部分页面中---
.connection.hub.start(); }); //--- in my partial pages ---


function (){ window .hubReady.done( function (){ // call hub method});}) ;
(function() { window.hubReady.done(function() { // call hub method }); });



但是当我打电话给


But when I call

window.hubReady.done(function() {});



在部分页面,我收到错误 hubReady不是功能

请参阅我的样本表格

如果你可以建议我真的很感激。

谢谢,

MinChanSike


at Partial page,I'm get error hubReady is not function.
Please see My Sample Form.
If you can suggest I'm really appreciate it.
Thanks,
MinChanSike


这篇关于如何在多个局部视图页面使用SignalR Hub?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆