Sharep10nt

All About SharePoint 2010/2013

  Home  |   Contact  |   Syndication    |   Login
  23 Posts | 0 Stories | 0 Trackbacks

News

Exploring SharePoint 2013 Online

Developing Nintex Workflows

Exploring SharePoint 2013

Acquired MCPD : SharePoint 2010 Developer

Share on Facebook

Archives

Post Categories

In SharePoint 2010, Notifications is another way to display information/warnings without distracting user. It'll be shown in top right below Topbar and Ribbon. Just like Status bar, No Server side code or manual setup required to use Notifications. The required functions are bundled in SP.UI.Notify class that defined in SP.Js/SP.Debug.Js and it's included in SharePoint master page. So no manual include of Js is required.

Well, Status bar is used to display content and to hide developer has to invvoke RemoveStatus or RemoveStatusAll Method, whereas Notifications by default getting hide after few seconds. It's possible to make notifications Sticky(stay until closed by code).

SP.UI.Status Notify
The SP.UI.Notify class has 2 functions. They are

  1. SP.UI.Notify.addNotification(strHTMLContent, boolIsSticky) This function used to display specified content in Notification area. The parameters are self explanatory. boolIsSticky parameter specifies whether this content should be shown as sticky(true) or hide after few seconds(false). It's possible to show multiple Notifications at a time and they getting aligned themselves.
  2. SP.UI.Notify.removeNotification(strNotifyID) This function hides the Notification that passed as parameter.

Sample Code
<
Script type="text/javascript">
var
strNotificationID, strStickyNotificationID;

function showNofication()
{
  strNotificationID = SP.UI.Notify.addNotification(
"Quick Info : <font color='#AA0000'>Registration in Progress..</font> <img src='/_Layouts/Images/kpiprogressbar.gif' align='absmiddle'> ", false);
  strStickyNotificationID = SP.UI.Notify.addNotification(
"Sticky Notes : <font color='#AA0000'>Welcome to My World.</font> <img src='/_Layouts/Images/lg_ICPINNED.gif' align='absmiddle'> ", true);
}

function removeNofication()
{
 
if (strStickyNotificationID != null)
    SP.UI.Notify.removeNotification(strStickyNotificationID);
}
</Script>

<
div class="ms-toolpanefooter">
  <
input type="button" onclick="Javascript:showNofication();" value="Show Nofitication" class="UserButton" />
 
<input type="button" onclick="Javascript:removeNofication()" value="Remove Nofitication" class="UserButton" />
</div>

Notifications

posted on Friday, November 19, 2010 10:10 AM

Feedback

# title 6/19/2013 4:31 PM name
Sorry, but this comment is a duplicate of another comment. Duplicate comments are not allowed.

# re: How to use Notifications in SharePoint 2010? 6/27/2013 11:14 AM navneet
Thanks dear, nice article..

# re: How to use Notifications in SharePoint 2010? 2/12/2014 9:44 AM Kris Krohn
Thanks for the tips. This really works great. - Kris Krohn


comments powered by Disqus