Black Blade Associates Logo A Black Blade Associates blog. Struggling with SharePoint? We can help.


Blog moved: This blog has moved to http://thingsthatshouldbeeasy.wordpress.com. Go there now to see the new posts.


Tuesday, January 05, 2010

HOW TO: Add web parts to SharePoint Item pages

I was thrilled when I first started working with WSS V3 and saw that the list item pages for creating, viewing, and editing list items were actual web part pages. This opened up a way to customize these pages for various lists in a way that was very difficult to do in WSS V2. But then I was shocked to find that the pages lacked an option to place them into edit mode. I knew these were web part pages because I could open them using SharePoint Designer 2007 and add web parts that way, but that was not always an option, especially when working on a client’s computer.

image

 

I examined what happened on other pages when a user placed them into edit mode. It turns out to be fairly simple. All the web user interface needs to do is call “MSOLayout_ChangeLayoutMode(false)” JavaScript method. Thankfully, Internet Explorer 8 has a very handy way to do this using the IE 8 Developer Tools Script Console. Here’s what you do:

  1. Navigate to the list’s Item page that you want to edit in Internet Explorer 8
     
    New Item  - “<list_url>/NewForm.aspx
    View Item - “<list_url>/DispForm.aspx
    Edit Item  - “<list_url>/EditForm.aspx
     
  2. Open the developer tools from the Tools menu or use the “F12” key

    image
     
  3. Switch to the Script tab

    image
     
  4. Execute the following JavaScript in the Run Script text box:
    window.location = 'javascript:MSOLayout_ChangeLayoutMode(false);';

    image

 

Presto! The page is now in edit mode and you have the familiar tools to edit and remove web parts. Just be careful: do not remove the New Item form from the page or you will need SharePoint Designer to add it back. The interesting thing is that once you’ve done this once for a list form, that form will then have the Edit Page menu item back on the Site Actions menu:

image

Technorati Tags: ,,

1 comments:

  1. You can achieve the same thing by adding toolpaneview=2 parameter on the url address. Example .../newform.aspx?toolpaneview=2

    ReplyDelete