状态图标仅对第一人称显示
我正在尝试在我的自定义 Web 部件中向我的同事展示。所以我给每个同事添加了状态图标。当同事只有 1 时,它显示良好。如果我们有超过 1 名同事 显示第一个同事的状态图标,您也可以下拉该图标,但其他同事则显示简单的状态图标(灰色)(不是下拉列表)。
代码是这样的。
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;
}
}
I am trying to show my colleagues in my custom webpart. So I adding presence Icon to each of colleague. It is showing fine when colleague is 1 only. If We have colleague more than 1
Presence Icon showing for 1st colleague you can dropdow that Icon also but other colleagues it is show simple Presense Icon (grayout) (not drop down is comming).
code is like this.
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 img 需要设置一个唯一的 id。看起来您已经快到了,通过为其分配值“
IMID[GUID]
”,而是尝试:
Your img needs to have a unique id set on it. It looks like you were almost there, by assigning it the value "
IMID[GUID]
"Instead try: