Sharepoint 2010 Scrollbar not working problem when hiding ribbon


Symptoms:

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

Cause:
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">
   <SharePoint:SPRibbon...
    Your ribbon
   </Sharepoint:SRibbon>
</div>
</div>
</SharePoint:SPSecurityTrimmedControl>

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

Correct:

<div id="s4-ribbonrow" style="display:none">
<div id="s4-ribboncont">
<SharePoint:SPSecurityTrimmedControl ID="CorrectUsage" runat="server" PermissionsString="ManageWeb">
   <SharePoint:SPRibbon...
    Your ribbon
   </Sharepoint:SRibbon>
</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="http://blog.bugrapostaci.com/_catalogs/scripts/jquery.js"></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">
$(document).ready(function()
{
$('#s4-ribbonrow').show();
});
</script>
</SharePoint:SPSecurityTrimmedControl>

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.

http://spribbonvisibility.codeplex.com/

Happy solutions …
Bye now.
.

Advertisements

About bpostaci
Sr. Support Escalation Engineer in Microsoft.

4 Responses to Sharepoint 2010 Scrollbar not working problem when hiding ribbon

  1. fungisil says:

    fungisil
    Great, what a nice read! This discussion board is precisely what I used to be on the lookout for, pleased I discovered this! Will certainly be linking this on my weblog! funginix

  2. JimiSweden says:

    Thanks a lot!

    // JimiSweden

  3. Tin says:

    Hello Bugra

    It totally works! Thanks. I have a little issue though. Not sure if it’s just me. I have a tool bar in my page. After I click ‘Cancel’ from attaching file, I’m seeing the blue bar again. That’s why I did the incorrect way. But if I did the incorrect way, my scroll bar is not working =/

  4. Thanks a lot sir !!! It worked for me !!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: