Javascript 使用ASP.NET MVC3的Lync/Communicator/Sharepoint状态控件
我目前正在将我们的商业网站从ASP.NET WebForms转换为ASP.NET MVC3。我目前正试图为我的用户添加一个状态指示器,就像我们使用WebForms时一样。在WebForms中,我们使用了一个名为Javascript 使用ASP.NET MVC3的Lync/Communicator/Sharepoint状态控件,javascript,asp.net-mvc,asp.net-mvc-3,sharepoint,lync,Javascript,Asp.net Mvc,Asp.net Mvc 3,Sharepoint,Lync,我目前正在将我们的商业网站从ASP.NET WebForms转换为ASP.NET MVC3。我目前正试图为我的用户添加一个状态指示器,就像我们使用WebForms时一样。在WebForms中,我们使用了一个名为NameControl.js(从Microsoft获得)的文件,其中包含站点代码: <ItemTemplate> <span class="presence"> <asp:Image Style="" ID="PresenceImage
NameControl.js
(从Microsoft获得)的文件,其中包含站点代码:
<ItemTemplate>
<span class="presence">
<asp:Image Style="" ID="PresenceImage" runat="server" ImageUrl="~/Common/Images/Shady/Presence/presence_16-unknown.gif" />
</span>
</ItemTemplate>
而且,这很好用。那么,回到原来的问题。目前,我正在列出使用WebGrid的用户,下面是我视图中的状态代码(在WebGrid中):
grid.Column(“Sip”,标题:”,格式:@),
现在发生的事情很简单,没什么。转义引号没有任何作用,将它们完全忽略。当我尝试使用'@item.Sip'
而不是“@item.Sip”
时,出现一个错误,指出:
Microsoft JScript运行时错误:“PresenceControl”未定义
我不知道该怎么办。有人有什么想法吗
好的,我发现了问题。Microsoft提供的Javascript出现语法错误,导致Javascript中断,无法正确加载。我在IE9()中使用web工具观看控制台输出时偶然发现了它。不管怎样,现在已经修好了我很感兴趣,你能提供一个指向microsoft
.js
下载的链接吗?找不到我的原始源代码,但在谷歌上找到了:
private void SetPresence(GridViewRow row, int PRESENCE_COL, string sip)
{
Image presenceImage = row.FindControl("PresenceImage") as Image;
if (string.IsNullOrEmpty(sip))
presenceImage.Visible = false;
else
{
presenceImage.Attributes.Add("onload", "PresenceControl('" + sip + "');");
}
}
grid.Column("Sip", header: "", format: @<text><span class="presence"><img id="@item.ObjectGuid" src="@Url.Content("~/Content/Images/Shady/Presence/presence_16-unknown.gif")" onload="PresenceControl("@item.Sip")" alt="" /></span></text>),