Sharepoint Edit in Datasheet locks or freezes Internet Explorer

I ran into an interesting issue in Sharepoint 2007 last week that took me a few hours to solve and was not easy to debug.  I couldn't find any info on it anywhere so I thought this would be a good candidate for my first post to this blog.

One of my customers reported that when they tried to use the "Edit in Datasheet" view on any list in Sharepoint 2007 their computer would lock.  When I went to take a look at this I found IE was locked and it was consuming 50%+ processor time.  I also noticed that they were using a custom system master page which was the key to this problem.

After digging at the problem for an hour or so I found a margin style tag on the body tag of the master page. 

 

 <body onload="javascript_spBodyOnLoadWrapper();" style="background-color: #5f9fd7; margin: 10px 10px 10px 10px;">
  

Suspecting that this might be part of the issue I removed this piece from the body tag and removed the custom style sheets they had inserted as well. This did fix the issue but now all my styles were gone.  When I added the custom style sheets back in the problem came back.  Still suspecting the margin issue I looked for margin tags in the style sheets.  I found one in a class called footer which, you guessed it, was a margin for the bottom of the page.  After removing this style the Edit in Datasheet feature worked without a problem, and I still had my custom master page and styles.

So, if Edit in Datasheet isn't working for you or it is causing excessive processor usage from IE, and you are using a custom master page, check for margin tags and remove them.