Frage

Ich versuche, meine Kollegen in meiner benutzerdefinierten webpart zu zeigen. Also habe ich das Hinzufügen Präsenz-Symbol zu jedem Kollegen. Es zeigt in Ordnung, wenn Kollege 1 nur. Wenn Wir haben Kollegen mehr als 1 Presence Symbol für die 1. Kollegen können Sie dropdow dass Icon auch aber auch andere Kollegen es zeigt einfacher PreSense Icon (grau unterlegt) (nicht im Dropdown steht vor der Tür).

Code ist wie diese.

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

War es hilfreich?

Lösung

braucht Ihr img ein eindeutiges ID-Set auf sie hat. Es sieht aus wie Sie es fast geschafft waren, indem sie sie den Wert „IMID[GUID]

Zuweisen

Stattdessen versuchen:

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>";
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top