Sharepoint 2010 Scrollbar not working problem when hiding ribbon


When using SPSecurityTrimmedControl for hiding Sharepoint 2010 ribbon scrollbar is not working for users who denied to see ribbon.

If you use SPSecurityTrimmedControl cover all divs that include the ribbon in masterpage , the page is not renders correctly. This is an incorrect programming situation .

Incorret usage:

<SharePoint:SPSecurityTrimmedControl ID="IncorrectUsage" runat="server" PermissionsString="ManageWeb">
<div id="s4-ribbonrow" style="display:none">
<div id="s4-ribboncont">
    Your ribbon

Use your SPSecurityTrimmedControl inside of divs which is already covers ribbon.


<div id="s4-ribbonrow" style="display:none">
<div id="s4-ribboncont">
<SharePoint:SPSecurityTrimmedControl ID="CorrectUsage" runat="server" PermissionsString="ManageWeb">
    Your ribbon
</SharePoint:SPSecurityTrimmedControl></div> </div>


For hiding ribbon correctly you need to add extra scripting .

First to be sure jquery added your master page .

<script type="text/javascript" src=""></script>

And we add an extra SPSecurityTrimmedControl which contains javascript for showing ribbon to who have to see.

<SharePoint:SPSecurityTrimmedControl ID="st1" runat="server" PermissionsString="ManageWeb">
this text will be shown by only admins
<script type="text/javascript">

and adding an extra attribute to cover div for hiding ribbon

<div id="s4-ribbonrow" style="display: none;">

Dont forget to save your master page and publish it.

If you dont want to attend too much you can download and use this tool for this.

Happy solutions …
Bye now.