I'm creating a webpart that shows the employees birthdays. It's a simple web part that when the page is loaded lists all birthdays for the current week (data comes from a SPList). My webpart then display the birthdays for the current day and hides the other birthdays in DIVs, one for each day. When I click on a different day, it'll show the birthdays for that day.
I also have 2 buttons to change the week that's being displayed. When I click on those buttons, my web part makes a SPQuery on the list and gives me the birthdays for that week. All that happens inside an UpdatePanel so the page won't be fully reloaded to show the birthdays.
At the side of the names, I have the bullet to show the user's status on Lync. For that i use the following function:
public static String MakeLynk(UserProfile user)
{
String sipOrMail;
String type;
if (!String.IsNullOrEmpty(Convert.ToString(user[PropertyConstants.SipAddress].Value)))
{
sipOrMail = Convert.ToString(user[PropertyConstants.SipAddress].Value);
type = "type=sip";
}
else
{
sipOrMail = Convert.ToString(user[PropertyConstants.WorkEmail].Value);
type = "type=smtp";
}
return String.Format("<span id=\"JBean\"><img alt=\"{0}\" border=\"0\" src=\"/_layouts/images/imnhdr.gif\" onload=\"IMNRC('{1}')\" ShowOfflinePawn=\"1\" id=\"CSRP_{2},{3}\" /></span>",
Convert.ToString(user[PropertyConstants.PreferredName].Value),
sipOrMail,
user.ID,
type);
}
The problem is: When I first load the page the status icons are shown correctly (online/offline/busy etc). But when I change the week (partial postback on my update panel), the status isn't shown anymore, every bullet is gray (offline) even for people that were showing as online (green) before I did the postback event (changed the week).
I believe that's because the OnLoad event (onload=\"IMNRC('UserSIPAddress')\") that's required on the IMG tag to display the status, isn't fired inside the UpdatePanel.
Is there a workaround to make my event (maybe removing from the onload of the image) fired even inside the update panel, so all my bullets will be displayed correctly even after a partial postback?