Edit in Datasheet causes IE to crash – Problem Solved

Ran into a very strange “perfect storm” type of error in SharePoint tonight. When a custom master page is applied, editing a list in Datasheet View causes IE to just hang. The thread goes bananas and you have to fight with Task Manager to kill the process. I’m not sure I completely understand WHY this problem occurs, but I do have a pretty good idea how to fix it.

Turns out you won’t see the problem unless some very specific scenarios are in place. If the custom master page has a DocType declared (which they all should) AND the parent HTML objects that contain PlaceHolderMain have ANY bottom padding applied OR there are any elements below the PlaceHolderMain inside of the same parent object (like a footer or Table cells) then for whatever reason the JavaScript that runs the Datasheet View gets confused and jumps into an infinite loop.

If you run into this problem, you have basically two options:

  1. You can methodically remove all bottom padding or objects below the PlaceHolderMain -OR-
  2. Add some overriding JavaScript to the master page that will correct the offending function.

 

I spent a LONG time studying this problem before this link helped me figure out what is going on:

http://tomblog.insomniacminds.com/2008/07/23/sharepoint-branding-issues-edit-in-datasheet-view/

I think getting rid of all the bottom padding and lower objects is a better solution, but I could imagine there could be instances where its not possible. In those cases, here is the JavaScript that can fix the problem. Make sure to place it after core.js in your master page: