Is it possible to use the Client Object Model or jQuery to get a list of the SharePoint 2010 web parts on a certain part of the page, say those in the DIV #main-content? To be more specific, I'd like to get a handle to the container for each web part in that DIV. Thanks.
|
|
|||
|
|
|
I didn't see the #main-content div in a SharePoint 2010 web part page. If this is a custom master page and you have it, you could use a jQuery selector like this:
It would return a collection of td elements that define the web parts in the zone.
To loop through each td element that was selected:
Alternatively, to iterate through all web parts on the page, you could remove #main-content from the selector:
|
|||||
|
|
I have a Codeplex project that does just that: http://spell.codeplex.com/documentation It's only version 0.0.1, but works quite well. Of course, it's an overkill in your case, but it could be useful if you need to do other stuff with the Web Parts in the future. As you can see from the documentation, it retrieves for each Web Part the header, body and container. |
|||
|
|