使用signalR不会在客户端调用方法 [英] method is not getting called at client side using signalR

查看:355
本文介绍了使用signalR不会在客户端调用方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个三层架构的拍卖网站。我有一个在AuctionHub.cs中定义的方法如下:



I am building an auction site in 3-tier architecture.I have a method which is defined in AuctionHub.cs as follows:

public BAL.LiveAuctionBAL AuctionBid(string Lot_Id, string InputAmt, string vendorid, string V_AuctionID, string AddModBy, string OpenBidAmt, string Decrementbid, string LastBidAmount, string auctionEndTimer)
{
BAL.LiveAuctionBAL BAL = new BAL.LiveAuctionBAL();
string result = "";
string msg = "", message = "";
try
{
BAL.Auction_Id = Convert.ToInt32(V_AuctionID);
BAL.Lot_Id = Convert.ToInt32(Lot_Id);
BAL.Vendor_Id = Convert.ToInt32(vendorid);
BAL.Bid_Amount = Convert.ToDouble(InputAmt);
if (auctionEndTimer != "")
{
BAL.AuctionEndTimer = DateTime.Parse(auctionEndTimer.ToString());
}
else
{
BAL.AuctionEndTimer = Convert.ToDateTime("01/01/1900");
}
BAL.AddMod_By = AddModBy;
result = BAL.AddAuctionBid();
if (result != "")
{
msg = result;
}
}
catch
{
}
return BAL;
}





现在我在客户端调用此方法如下:



now I am calling this method at client side as follows:

jq(function () {
jq.connection.hub.start().done(function () {
chat.server.auctionbid(Lot_Id, InputAmt, vendorid, V_AuctionID, AddModBy, OpenBidAmt, Decrementbid, LastBidAmount, auctionEndTimer);
}





但它不起作用...请帮帮我。对我来说非常紧急..谢谢提前



but its not working...please help me with this.Its very urgent for me..Thanks in advance

推荐答案

您可以在客户端使用以下代码

You can use below code at client side
var NotificationConnection;


(document).ready (function(){
try {
NotificationConnection =
(document).ready(function () { try { NotificationConnection =


.connection.Notification;
NotificationConnection.client.UpdateUnreadCountClient = function(objCount){
}
.connection.Notification; NotificationConnection.client.UpdateUnreadCountClient = function (objCount) { }


这篇关于使用signalR不会在客户端调用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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