在线图标只显示为第一人
-
24-09-2019 - |
题
我想表明我的同事在我的自定义web部件。所以,我将状态图标上的每个同事。它是显示正常,当同事仅为1。如果我们有同事超过1 示出了第一个同事在线图标,你可以dropdow该图标也不过其他同事也显示简单Presense图标(灰朦)(降不下来是正在添加)。
代码是这样的。
private static Panel GetUserInfo(UserProfile profile,Panel html, int cnt)
{
LiteralControl imnrc = new LiteralControl();
imnrc.Text = "<span style=\"padding: 0 5px 0 5px;\"><img border=\"0\" valign=\"middle\" height=\"12\" width=\"12\" src=\"/_layouts/images/imnhdr.gif\" onload=\"IMNRC('" + profile[PropertyConstants.WorkEmail].Value.ToString() + "')\" ShowOfflinePawn=1 id=\"IMID[GUID]\" ></span>";
html.Controls.Add(imnrc); html.Controls.Add(GetNameControl(profile)); //html.Controls.Add(new LiteralControl("<br>"));
return html;
}
private static Control GetNameControl(UserProfile profile)
{
//bool hasMySite = profile[PropertyConstants.PublicSiteRedirect].Value == null ? false : true;
bool hasMySite =string.IsNullOrEmpty(profile.PublicUrl.ToString()) ? false : true;
string name = profile[PropertyConstants.PreferredName].Value.ToString();
if (hasMySite)
{
HyperLink control = new HyperLink();
control.NavigateUrl = String.IsNullOrEmpty(profile.PublicUrl.ToString()) ? null : profile.PublicUrl.ToString();
control.Style.Add("text-decoration","none");
control.Text = name;
return control;
}
else
{
LiteralControl control = new LiteralControl();
control.Text = name;
return control;
}
}
http://i700.photobucket.com/albums/ww5 /vsrikanth/presence-1.jpg
解决方案
您IMG需要有一个唯一的ID集。它看起来像你几乎那里,分配值“IMID[GUID]
”
相反尝试:
imnrc.Text = "<span style=\"padding: 0 5px 0 5px;\"><img border=\"0\" valign=\"middle\" height=\"12\" width=\"12\" src=\"/_layouts/images/imnhdr.gif\" onload=\"IMNRC('" + profile[PropertyConstants.WorkEmail].Value.ToString() + "')\" ShowOfflinePawn=1 id=\"IMID" + Guid.NewGuid().ToString() + "\" ></span>";
不隶属于 StackOverflow