Using SPPageStatusSetter to Show Status SharePoint 2010 |
In this post you will learn how to display a Status of an item ( i.e. if item has been added, updated, deleted or whatever…) in your status bar that renders just below the ribbon and the top navigation menu. Well, the thought process is to include the SPPageStatusSetter control in a web part and then dynamically adding this web part to list view page from an event receiver along with status bar message. The reason behind this approach is because you cannot get the current page context in event receiver to include SPPageStatusSetter control to any page. In Nutshell, we will create a webpart with the SPPageStatusSetter control and will set the message(for the SPPageStatusSetter via property) in our event receiver. Create a WebPart – Create an empty SharePoint project. Add a web part item and an event receiver item. Now in the web part code add a custom property and add the SPPageStatusSetter control. The message(status) for the SPPageStatusSetter control will be set through the custom property of web part from event reciever. Web part Code : public class StatusBarWebpart : WebPart public StatusBarWebpart() [Category("Custom Properties")][Browsable(false) public string Message protected override void CreateChildControls() protected override void RenderContents(HtmlTextWriter writer) Now we will add Now add the custom web part which contains the SPPageStatusSetter control dynamically in the events and make sure that you change the status of the SPPageStatusSetter control in every event through the custom property of the web part. public class EventRecieverStatus : SPItemEventReceiver StatusBarWebpart. public override void ItemAdded( if (coll.WebParts.Count > 1) public override void ItemUpdated( if (coll.WebParts.Count > 1) |
Monday, November 28, 2011
Using SPPageStatusSetter to Show Status SharePoint 2010
Category:
SharePoint 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment