Error with DataForm web part in SharePoint 2010
by Deepu Nair • December 7, 2011 • SharePoint 2010 • 0 Comments
I had recently seen in forums where people have issues with DataForm web parts in SharePoint 2010, one way or the other. So I thought its time to make it a post.
Error Scenarios:
These are the possible errors that can occur:
1. SharePoint Designer popping up correlation ID with detailed error something like this
Error while executing web part: System.StackOverflowException: Operation caused a stack overflow.
2. Error while saving site as template
System.InvalidOperationException: Error generating solution files in temporary directory.
at Microsoft.SharePoint.SPSolutionExporter.ExportWebAsSolution()
This issue might appear for just one site or subsite in the whole site collection. Basically it could be assumed that this occurs with a particular site that has a DataForm web part or any web part that inherits from this DataForm web part. Removing the DataForm webparts from the site or page might bring things to normal.
Why errors all of a sudden?
Recently, the following Security Update KB 2494001, http://support.microsoft.com/kb/2494001 and the June 2011 cumulative update for SharePoint 2010 has updated the timeout for the Data Form web part and the web parts that inherit from the Data Form web part.
Basically farms that have recently been upgraded with cumulative updates might find these issues.
Possible Solution
The only workaround for the web parts timing out is to apply one of the solutions listed in KB 2639184, released by Microsoft.
http://support.microsoft.com/kb/2639184
There are 3 solutions provided in this article and I believe the 3rd solution would be an ideal solution for large Data Form XSLT transformations. Here are the details -
1.) Sub class the DataForm Web Part. Override the following methods. Then Deploy the assembly.
Example:
public class customDFWP : DataFormWebPart
{
public override bool IsGhosted
{
get
{
return true;
}
}
public override bool CanHaveServerControls
{
get
{
return true;
}
}
}
2.) Add a safe control entry to the web.config
Example:
<SafeControl Assembly="customDFWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=963f869a440db619" Namespace="customDFWP" TypeName="*" Safe="True" AllowRemoteDesigner="True" SafeAgainstScript="False"/>
3.) Add the following to the <tagMapping> element of the web.config
Example:
<add tagType="Microsoft.SharePoint.WebPartPages.DataFormWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" mappedTagType="customDFWP.customDFWP, customDFWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=963f869a440db619" />
4.) Register the assembly on the form page.
Example:
<%@ Register tagprefix="customDFWP" namespace="customDFWP" assembly="customDFWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=963f869a440db619">
5.) On the form page find <WebPartPages:DataFormWebPart > and replace it with the new custom tag.
Example:
<customDFWP:customDFWP>
Again, if nothing goes right remove the Data Form web part and try to accommodate the same logic differently, may be using a custom web part with css.
