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 would like to use SP.UI.Notify or jQuery in SharePoint 2010 to display messages when a new document is added or a new item is posted.

So if the users are on the page I just want the message to popup with no postbacks.

Is this possible? Just thinking: How can I trigger this event without refreshing the page?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

One way: You can set up a timer in client code to make an ajax requerst to the server-side code to check your desirable conditions. One way to do it is a standard ASP.NET technique described here: http://ajaxzen.wordpress.com/tag/icallbackeventhandler/ You can implement it in the custom webpart or delegate control. Then all you need is to receive instructions periodically via ajax request and to show a notification with standard SharePoint notifications framework in the ajax request callback function. The whole work is about twenty lines of code.

Two way: Another way is to employ the javascript version of the SharePoint client object model - then you can retrive a number of documents/items in the list, save it in the variable on client and compare with the new value next time - if the new value is greater than new documents was added.

Conclusion: Anyway the key components is the javascript timer + request to server via callback or client object model + standard SharePoint notifications framework.

share|improve this answer
    
Thanks Alex this is really food for thought –  naijacoder Feb 28 '12 at 22:58

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.