Show Status Bar through C# Code


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. using Microsoft.SharePoint.WebControls;
  2.  
  3. //....
  4.  
  5. //Add Page Status bar
  6. SPPageStatusSetter statusSetter = new SPPageStatusSetter();
  7. statusSetter.AddStatus("Aktiviert", "Daten wurden erfolgreich übertragen.", SPPageStatusColor.Green);
  8. this.Controls.Add(statusSetter);
  9.  
  10. //Set JavaScript function to remove Status Bar after 5 seconds
  11. string jsFunction = @"<script type='text/javascript'>" +
  12. "window.setTimeout(function(){ SP.UI.Status.removeAllStatus(true); }, 5000);" +
  13. "</script>";
  14. Page.RegisterClientScriptBlock("RemoveStatusBar", jsFunction);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.