SP.UI.Status.addStatus(strTitle, strHtml, atBegining) Method
Applies to: SharePoint Foundation 2010
Adds a status message to the page.
var value = SP.UI.Status.addStatus(strTitle, strHtml, atBegining);
Parameters
strTitle
The title of the status message.
strHtml
The contents of the status message.
atBegining
Specifies whether the status message will appear at the beginning of the list.
Return Value
Type: String – The ID of the status message.
Applies To
Example
The following example creates input buttons on an application page that display and remove alert notifications and status messages.
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script type="text/ecmascript" language="ecmascript">
var statusId = '';
var notifyId = '';
function AddNotification() {
notifyId = SP.UI.Notify.addNotification("Hello World!", true);
}
function RemoveNotification() {
SP.UI.Notify.removeNotification(notifyId);
notifyId = '';
}
function AddStatus() {
statusId = SP.UI.Status.addStatus("Status good!");
SP.UI.Status.setStatusPriColor(statusId, 'red');
}
function RemoveLastStatus() {
SP.UI.Status.removeStatus(statusId);
statusId = '';
}
function RemoveAllStatus() {
SP.UI.Status.removeAllStatus(true);
}
</script>
<input id="Button1" type="button" value="Add Notification" onclick="AddNotification()" />
<input id="Button2" type="button" value="Remove Notification" onclick="RemoveNotification()" />
<p></p>
<input id="Button3" type="button" value="Add Status" onclick="AddStatus()" />
<input id="Button4" type="button" value="Remove Last Status" onclick="RemoveLastStatus()" />
<input id="Button5" type="button" value="Remove All Status" onclick="RemoveAllStatus()" />
</asp:Content>