Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In SharePoint 2010, if you have more than one web part on a web part page, the ribbon disappears because SharePoint doesn't know which web part to display the ribbon for (this is by design because if you have a document library web part and a list web part on the same page, the ribbons are obviously different for the two and SharePoint needs to know which web part to display the ribbon for).

Once you select a web part (by clicking on it) the selected web part will become "active" and the correct ribbon will show up.

Is there a way to automatically select a list view web part on load? Can this be done via javascript or a querystring SharePoint can understand?

For example, if I have a document library web part and a list view web part on a page, I want the document library web part to be selected by default and the document library ribbon to show when the page is first loaded.

share|improve this question
    
My issue is also simillar but the actual problem is that in my page i have a couple of webparts and the ribbon is not showing up even afetr selecting item check box, can you please help me in resolving the issue. Thanks Bala –  user4239 Jul 26 '11 at 14:36
add comment

1 Answer 1

Put this in a content editor webpart

<script>
setTimeout(function() {
    var elem = document.getElementById("MSOZoneCell_WebPartWPQ2");
    if(elem != null) {
        var dummyevent = new Array()
        dummyevent["target"] = elem
        dummyevent["srcElement"] = elem
        WpClick(dummyevent)
    }
}, 2000)
</script>
share|improve this answer
1  
Brilliant, thanks djeeg! I changed the code to this so there isnt a 2 second delay. <script> $(document).ready( function() { var elem = document.getElementById("MSOZoneCell_WebPartWPQ2"); if(elem != null) { var dummyevent = new Array() dummyevent["target"] = elem dummyevent["srcElement"] = elem WpClick(dummyevent) } } ) </script> –  user9254 Jul 3 '12 at 6:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.