If you might want to customize the ribbon, mostly you’ll find posts about how to develop your custom ribbon and put into a tab, group or anything, or you find how to remove buttons. But what if you just want to hide the whole ribbon? For example using custom display forms or edit or new forms, if you want to have some actions like print view or you have the requirement only to show the ribbon if special actions required.
This code should do the work. It might be necessary to put it into the oninit function.
[sourcecode language=”csharp”]
SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);
if (ribbon != null)
{
ribbon.CommandUIVisible = false;
}
[/sourcecode]
If you look into the google search database you’ll find some more examples for using SPRibbon and its attributes – might be interesting.
..:: I LIKE SHAREPOINT ::..
Leave a Reply
You must be logged in to post a comment.