How to collapse Ribbons bar when page is loaded?
When user click on an item display view (DispForm.aspx) the "View" ribbon is always expanded by default. It is annoying sometimes. How can I to make it collapse (not hide) by default? When user need the ribbon buttons he can click the "View" link at top to expand it.
May 19th, 2015 9:58pm

Hi,

We can add the following JavaScript code into a Content Editor Web Part in the DispForm.aspx page to achieve your requirement.

<script  type="text/javascript"> 
SP.SOD.executeOrDelayUntilScriptLoaded(function() { 
	try {	    
		 _ribbonStartInit("Ribbon.Read" , true , null );         
	}catch(e){
		//alert("error message");
	}
},"sp.ribbon.js");   
</script>

Or we can add InitialTabId=Ribbon.Read in the QueryString. Like this:

http://sp/Lists/CustomList/DispForm.aspx?ID=1&InitialTabId=Ribbon.Read

More information:

http://www.sharepointdevelopment.me/2010/11/set-active-ribbon-tab-from-querystring/

Best Regards,

Dennis

Free Windows Admin Tool Kit Click here and download it now
May 20th, 2015 10:17pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics