Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
1  
I've found this post with a solution, but still the same thing, it stops working after postback. stevemannspath.blogspot.com.br/2011/03/… –  C. Hoffmann Mar 6 '13 at 20:35
    
Is there not a way in an update panel to make it do a full postback? Using a trigger? –  Stephen Mar 19 '13 at 14:18
1  
can you post some more code to see where your going wrong? it seems like it shouldnt be too hard to make somthing like this! you could be missing a method that you can create and call when needed inside and outside of the update panel to show the bullets –  ali Sharepoint Mar 26 '13 at 16:23
1  
Isn't it a issue with second postback? marten-online.com/sharepoint/… –  luccio Apr 18 '13 at 8:22
add comment

1 Answer

you can call MakeLynk(UserProfile user) within your updatepanel!

I would also suggest that you could store the values within a session state and reload the values back again or use:

if (!Page.IsPostBack) { your code here }

both of those examples can be found here:

How to save variables per user session per page

as I dont have more code to go by I wouldnt be able to see where the values are being set, so the first time round the values are correct! but the second time round the object that contains/varible image is reset (that being grey) without going through the code that is setting the image! , either have if (!Page.IsPostBack) { your code here } on the varible/object so its not rerun or call the method that sets the value within the updatepanel or on onPreRender that checks to see if that has been a postback, if true call method else dont!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.